3 ms·
Don't forget those reallocations require copying as well. Also reallocation can increase memory fragmentation, not that it matters for this toy problem. Basic
by gumby 3y ago
Don't forget those reallocations require copying as well. Also reallocation can increase memory fragmentation, not that it matters for this toy problem.
Basically doing less computation is always a win when it's trivial to do so. This is not a c++ issue.