Tuesday, April 7, 2015

performant vs clean code

Today I read a really good article about development performance vs simple-clean development.
The article (and its comments) highlights some very good points I definitely agree with.
In short:
simple is better than performant:
  • before: performance (how fast to do something) != efficiency (how long to do it)
    • if you run 2 miles you can be more performant than a guy walking a single mile,
    • but if you reach the same goal by walking only one mile you are much more effective
  • try to write efficient code before you write performant code because your intention will still be understandable and the code keeps being readable
  • check whether the code to optimize is needed to be optimized (or called rarely, so it doesn't contribute to total run-time)
  • optimization needs tooling to find painful parts in the code
  • optimize the data store first
  • check for other bottlenecks (e.g.: hardware, user input,...) 
  • check for best practices, libraries and patterns
  • use caching instead of recalculating the hard stuff

kind regards,

No comments: