Chris Pearce: Not every bit of code you write needs to be optimal

2 news today, 367 news this week, 6098 news in total. 193 Projects.
It's easy to fall into the trap of obsessing about performance and try to micro-optimize every little detail in the code you're writing. Or reviewing for that matter. Most of the time, this just adds complexity and is a waste of effort.If a piece of code only runs a few (or even a few hundred) times a second, a few nanoseconds per invocation won't make a significant difference. Chances are the performance wins you'll gain by micro optimizing such code won't show up on a profile.Given that, what should you do instead? Code is read and edited much more than it is written, so optimize for readabi...
Mozilla Logo
Date