4 ms·
My simple rule of thumb: if the general purpose allocator shows up in performance profiles, then there's too much allocation going on in the hot path (e.g. depe
by flohofwoe 1y ago
My simple rule of thumb: if the general purpose allocator shows up in performance profiles, then there's too much allocation going on in the hot path (e.g. depending on the 'system allocator' being fast in all situations is a convenient but sloppy attitude for code that's supposed to be portable since neither the C standard nor POSIX say anything performance).
- saagarjha 1y agoThey don't, but if your C standard library is slow you should get a new one.
- flohofwoe 1y agoFWIW on Emscripten I specifically pick the slow-but-small emmalloc instead of the fast-but-big jemalloc because a small size matters more than performance in that case. My C code also rarely heap-allocates, and the few heap-allocations that happen are all in the init-phase, not in the hot path - e.g. even in multithreaded code, the MUSL allocator would be totally fine. Performance in edge-cases by far isn't the only metric that matters for allocators.