Comment on Explain yourselves, comp sci.

<- View Parent
IAmVeraGoodAtThis@lemmy.blahaj.zone ⁨2⁩ ⁨months⁩ ago

Which is why you should:

  1. Preallocate the vector if you can guesstimate the size
  2. Use a vector library that won’t reallocate the entire vector on every single addition (like Rust, whose Vec doubles in size every time it runs out of space)

source
Sort:hotnewtop