News for hackers. Stuff that matters.
Re:A Fast, Growable Array with Stable Pointers in C by tovej on Wednesday August 06, 2025 @03:37PM (#44816656)
Very nice! I do wonder if it would be useful to be able to skip even more smaller segments, maybe a ctor argument for the minimum segment size. Or maybe some housekeeping functions to collapse the smallest segments into one.

Mostly the thing that feels strange is when using say, n > 10 segments, then the smallest segment will be less than a thousandth of the largest, and iterating over the first half will access n-1 or n-2 segments, worse cache behaviour, while iterating over the second half will access 1 or two segments.

Seems like, in most cases, you would want to be able to collapse those earlier segments together.

Re:A Fast, Growable Array with Stable Pointers in C by brunokim on Thursday August 07, 2025 @11:36AM (#44825882)
If you do that, you lose those stable pointers.