Comment

Comment by throwaway173738

Suppose I think I may need 128 entries at some point, but the vector is allocated with room for 16 entries by default. I may not want to allocate and then immediately allocate again. But if I get to a 17th entry then I’m already causing allocation. So I might as well allocate 128 at that time so there are no more allocations at all.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton