Understanding CPU Branch Prediction and Its Impact on Benchmarking
By
ibobev
Crackles when you bite it. Shows the baker did the work.
Summary
The article discusses how modern processors use branch prediction to execute multiple instructions per cycle, explaining that CPUs have remarkable branch prediction capabilities. It highlights how this makes benchmarking challenging because small datasets can yield misleading results that don't reflect real-world performance. The author shares their preferred benchmarking approach using random values to test branch prediction accuracy.
Key quotes
· 5 pulledModern processors have the ability to execute many instructions per cycle, on a single core.
To be able to execute many instructions per cycle in practice, processors predict branches.
I have made the point over the years that modern CPUs have an incredible ability to predict branches.
It makes benchmarking difficult because if you test on small datasets, you can get surprising results that might not work on real data.
The processor tries to predict the branch (if clause). Because we use random values...
You might also wanna read
Optimizing Code Performance When Branch Prediction Works Against You
The article discusses techniques for optimizing program performance when branch prediction works against the code, using a financial/trading
Disk Access Outperforms Memory Caching in Modern Hardware Systems
This technical article challenges conventional computer science wisdom by demonstrating that sourcing data directly from disk can be faster
Optimizing .NET APIs for High Throughput: Techniques for 1M Requests Per Minute
Article discusses techniques for designing high-throughput .NET APIs capable of handling 1M requests per minute. It covers horizontal scalin
Reverse-engineering the Intel 8087: A look at microcode and register exchange
A detailed technical deep-dive into the Intel 8087 floating-point co-processor's microcode, specifically examining the register exchange ope

How micro-optimizations in Azure Service Bus SDK paved the way for a smarter redesign
The article discusses how micro-optimizations in the Azure Service Bus SDK led to meaningful design improvements. Rather than advocating for
How Kestra Improved Orchestrator Performance Across 14 Releases: A Year of Performance Engineering
Kestra's engineering team details their year-long performance engineering journey across releases 0.19 to 1.3, treating performance as an on
