All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Optimizing Code Performance When Branch Prediction Works Against You

By

signa11

6mo ago· 5 min readenInsight

Summary

The article discusses techniques for optimizing program performance when branch prediction works against the code, using a financial/trading system example where most transaction requests are abandoned. It explores how to bypass or work around branch predictor limitations to improve performance in scenarios with unpredictable or biased branching patterns.

Key quotes

· 4 pulled
A couple of days ago I was thinking about what you can do when the branch predictor is effectively working against you, and thus pessimizing your program instead of optimizing it.
Let's work with something relatively simple & concrete: consider that we want to write some kind of financial system (maybe a trading system) and all of our transaction requests arrive at a certain function before being either (a) sent out to some authoritative server, or (b) abandoned.
The vast majority of our transaction requests end up being abandoned at the last step.
We care A LO
Snippet from the RSS feed
A couple of days ago I was thinking about what you can do when the branch predictor is effectively working against you, and thus pessimizing your program instead of optimizing it.

You might also wanna read