Hacker News new | ask | show | jobs
by throwaway823882 1864 days ago
> 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.