r/programming • • Aug 22 '26

The unlikely Linux macro

https://rushed-reflections.bearblog.dev/an-unlikely-experiment/

Wrote a bit about the `unlikely` and `likely` macros in the Linux codebase. Great little exploration into tiny optimizations that everyone should know more about 😄

188 Upvotes

61 comments sorted by

View all comments

Show parent comment

3

u/therealgaxbo Aug 25 '26

Definitely a coffee error - the code tests i % 1000 not total % 1000

1

u/negrocucklord Aug 28 '26

Ooh derp! Thanks!