News for hackers. Stuff that matters.
Re:Branch predictor: How many “if”s are too many? by Retric on Thursday May 06, 2021 @10:37PM (#27071376)
Jump tables can still be vastly faster than if-else-if though it really depends on the specifics such as the frequency of each option being correct. Best practices are always subservient to benchmarks when optimizing.
Re:Branch predictor: How many “if”s are too many? by samus on Friday May 07, 2021 @06:43AM (#27074455)
The greatest advantage of jump tables is that they are flexible, within certain margins. You could populate them with entries from a config file or a database without having to go through a full release cycle.