News for hackers. Stuff that matters.
Re:Do Not Taunt Happy Fun Branch Predictor by xKingfisher on Wednesday January 25, 2023 @10:48PM (#34527464)
It's mentioned in passing at the end of the "the trouble with interpreter loops" section.

A traditional switch/goto loop can thrash the branch predictor. Separating into different tail calling functions gives you more slots and allows the branch predictor to learn relationships between ops.

Not to discount the many other benefits of tail calls.

*Edit: I misspoke slightly, computed gotos can also split the patch jump, but less reliably[0].

[0]https://gcc.gnu.org/pipermail/gcc/2021-April/235891.html

There are no comments on this comment yet.