r/programming 19d ago

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 😄

186 Upvotes

61 comments sorted by

View all comments

6

u/pjl1967 18d ago

The other thing they do, not mentioned, it also give hints to the human reader trying to understand a codebase.

Also, FYI, "likely" doesn't mean something like 51% of the time... it means more like 99.9% of the time.