On Thu, Dec 28, 2023 at 7:58 PM Ranier Vilela <ranier.vf@gmail.com> wrote: > I think it would be more productive to initialize the entire array with -1, and avoid flagging, one by one, the items that should be -1.
This just moves an operation from one place to the other, while obliterating the explanatory comment, so I don't see an advantage.
Well, I think that is precisely the case for using memset.
The way initialization is currently done is much slower and harmful to the branch. Of course, the gain should be small, but it is fully justified for switching to memset. Regarding the comment, once initialization is done via memset, such as prstate.marked, it becomes irrelevant and unnecessary.