Should a developer aim for readability or performance first? [closed]

You missed one.

First code for correctness, then for clarity (the two are often connected, of course!). Finally, and only if you have real empirical evidence that you actually need to, you can look at optimizing. Premature optimization really is evil. Optimization almost always costs you time, clarity, maintainability. You’d better be sure you’re buying something worthwhile with that.

Note that good algorithms almost always beat localized tuning. There is no reason you can’t have code that is correct, clear, and fast. You’ll be unreasonably lucky to get there starting off focusing on `fast’ though.

Leave a Comment