If you’re winging it, at least use a language with decent defaults. Java’s ArrayList or C#’s List<T> handle growth pretty well.
But if you’re rolling your own, maybe try a tiered approach? Like, small chunks first, then consolidate later.
Horror story: Once had a hash table resize mid-loop. Never again. Now I always pre-size if I can.
But if you’re rolling your own, maybe try a tiered approach? Like, small chunks first, then consolidate later.
Horror story: Once had a hash table resize mid-loop. Never again. Now I always pre-size if I can.
