News for hackers. Stuff that matters.
Re:Branch predictor: How many “if”s are too many? by throwaway823882 on Thursday May 06, 2021 @09:44PM (#27071006)
> Is it ok to have if clauses that will basically never be run?

Yep.

> But when I thought about it more: should it be improved?

Nope.

If you are an average programmer, you should write your code first to be legible and maintainable.

If you are a smart programmer, you should add performance tests to your test suite (since you need to do performance testing anyway for any production-critical code) and run your app on the appropriate-sized machine.

If you are a very smart programmer, you should rely on performance hacks when your application no longer meets performance requirements under heavy load.

If you are a freaking genius, you should think about optimizing your code.

There are no comments on this comment yet.