Hi all,
Is there a nice way to ensure that I allocate my vectors with sufficient capacity? I would basically like something which can help remind me to use
Vec::with_capacity(n);
where possible.
I know that I can inspect Vec::capacity
before and after my operations to see if the vector was enlarged — however, this is a manual process which requires me to sprinkle temporary tracking code here and there.
Is there a more systematic way to do this? Perhaps some way of profiling a binary and detect calls to Vec::reserve
(or the equivalent function which does the low-level reallocation)?