mimalloc: A new, high-performance, scalable memory allocator for the modern era

23 points by eatonphil


david_chisnall

There doesn't look like there's much new there. The tricks described in the post for making the fast path really fast look like a mix of the ones that snmalloc adopted from mimalloc and the ones mimalloc adopted from snmalloc 5+ years ago.

My favourite one that we copied from mimalloc that avoided a branch on the fast path was to statically initialise the thread-local block point to an immutable empty allocator (an empty free list in mimalloc). This means that check that takes you off the fast path is the check for there being memory available on the local cache to allocate. After you fall off the fast path, you do the TLS-needs-initialising-with-proper-mutable-state check, because there one extra branch is very cheap: you're already on a code path that's hit 0.1% of the time or less. Obvious in hindsight.