Conversation

This Tweet was deleted by the Tweet author. Learn more
To be fair to jemalloc, they have the super cursed red-black tree implementation for real reasons. It's blazing fast and with RB_COMPACT the nodes are only 2 words, with the color bit packed into a pointer. It's intrusive so no extra allocation and multiple can go in an object.
1
It goes out of the way to avoid recursion in any of the hot paths to avoid the cost of creating stack frames which makes it a lot messier. I definitely do think jemalloc is very over-engineered and that a simpler approach from scratch can be better all around but it's not easy.