I've been looking through some of the jemalloc code and had a question about bitmap.h.<br><br>Testing on a 64-bit machine, the arena bin with the most elements is size=8 with 501 items.  Since a cacheline is commonly 64 bytes = 512 bits, a simpler single-level bitmap would seem to win just on memory effects.<br>
<br>It's not clear to me if its advantageous on a branching basis, at least on 64-bit.  On average you'd need to look at 4 words to find an unused 8-byte entry, and fewer for other size bins.  I guess on a 32-bit platform, it might be a different story.  Still, I wonder if it is worth touching another cache line to avoid the comparisons.<br>
<br>Are there cases where the bitmap code is used for more than 512 items in it?<br><br>-Mitch<br>