4 ms·
No, this is not true. Static allocation is always faster than dynamic allocation _if_ you know you're going to use it. I think what they're suggesting here is
by inglor 9y ago
No, this is not true. Static allocation is always faster than dynamic allocation _if_ you know you're going to use it.
I think what they're suggesting here is not to dynamically allocate large arrays - it's to allocate "as you go" (increase when you need to).
For example, bluebird is very allocation averse - but we do actually grow a few things as we go (like the queue) if we didn't allocate enough ahead of time.