Conversation

libdivide lets you set up compiler-like optimizations for division when the number you’re dividing by isn’t known at compile time. It’s amazing that it makes such a big difference for a malloc! //
Quote Tweet
I love libdivide. Moving to libdivide-2.0 in hardened_malloc is an easy win. 16 byte malloc microbenchmark on Broadwell-E: Hardware division: 1s libdivide-1.1: 0.74s libdivide-2.0: 0.71s In a lightweight build: Hardware division: 1s libdivide-1.1: 0.62s libdivide-2.0: 0.59s
Show this thread
1
9
Delta will also likely grow a bit as I optimize since there's a lot of low-hanging fruit. Using division to find out-of-line metadata for slab allocations in the dedicated metadata region is fundamental to the design. Can't use only powers of 2 since it'd waste lots of memory.
1
1