I recently created the world's fastest compression library in C, and now I just almost doubled its speed by making it branchless.
The pseudocode shows how I advance the destination pointer with simple arithmetic, and how I select what to write there with a conditional move (that hopefully turns into a cmov instruction):
I recently created the world's fastest compression library in C, and now I just almost doubled its speed by making it branchless.
The pseudocode shows how I advance the destination pointer with simple arithmetic, and how I select what to write there with a conditional move (that hopefully turns into a cmov instruction):
Before:
After: