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

