←back to thread

40 points coneonthefloor | 1 comments | | HN request time: 0.209s | source
Show context
WalterBright ◴[] No.44611357[source]

    new_capacity *= 2;
A better value is to increase size by 1.5:

https://stackoverflow.com/questions/1100311/what-is-the-idea...

replies(3): >>44611645 #>>44612459 #>>44613415 #
1. burnt-resistor ◴[] No.44612459[source]
Yep. And probably use tcmalloc or jemalloc (deprecated?) too. Most OS sbrk/libc malloc implementations are better than they used to be, but certain profiled programs can increased performance by tuning one of the nonstandard allocators. YMMV. Test, profile, and experiment.