- Published on
Investigation · Part 18 of 20 · When the benchmark lies
The Benchmark Measured the Allocator
A small formatting function took 52 ns per call with a new String and 38 ns with a reused buffer. A 256 KiB buffer cost nothing extra after the first call. And the contention that I saw with four threads came from my own allocation counter, not from malloc.