Comment on Explain yourselves, comp sci.
IAmVeraGoodAtThis@lemmy.blahaj.zone 6 months agoWhich is why you should:
- Preallocate the vector if you can guesstimate the size
- 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)