2 ms·
This caused me a lot of grief back when I was working on Protobufs and doing lots of microbenchmarking. I'd often make a change and find it affected the perform
by kentonv 11y ago
This caused me a lot of grief back when I was working on Protobufs and doing lots of microbenchmarking. I'd often make a change and find it affected the performance of test cases that didn't even execute the changed code, sometimes by double-digit percentages.
Another problem that can cause a lot of noise between two executions of the same executable is positioning of data. For instance, two objects on the heap can alias in the TLB cache. If you run your microbenchmark in a loop reusing the same data structure over and over (as my benchmarks tended to do), then there can be a huge difference in performance depending where those structures landed in the heap. I ended up fixing this one by allocating 100 different copies of the structure and cycling through them.
Ultimately, though, I came to the conclusion that microbenchmarks have almost nothing to do with real-world performance, and I was just wasting my time all along. :/