Development Tip 8: Premature optimisation of software development projects

26 Apr. 22
161 VIEWS

Donald Knuth is well-known for his famous statement, “Premature Optimization is the root cause of all evil.”

This quote in its entirety sheds more light on the importance of optimizing development.

We need to forget about the small efficiency gains, which is 97% of the time. Premature optimization is the root cause of all evil. We should not miss out on the critical 3%.

What impact will premature optimization have on software development?

  1. Modern frameworks and languages go to great lengths today to ensure that they run with speed in mind. There is no need for you to worry about garbage collection or keeping your memory footprint small when performing complex calculations. Frameworks and languages will handle those tasks (and much better) than you.
  2. Your apps will run on servers with sufficient memory and disk space. There is no need to use ternary operators or one-letter variables.
  3. Now common tasks such as database queries or asynchronous operations can be written in just a few lines. Your framework handles the rest, often with better performance than if it were written from scratch.

These points will help you focus on writing clean code that is easy to maintain. Performance is an important aspect of any solution. However, it shouldn’t be the driving force behind your project. With the vast optimizations and machine power available, this should be an optional consideration. Your code may be less efficient and more difficult to maintain.

What about the crucial 3% of optimization? It is a great way of identifying bottlenecks in your code that can cause performance problems by setting up benchmarking and profiling tools. You can find many performance analysis tools for your language. You can also stress test your web pages and servers with services such as loader.io or NewRelic to determine where performance is suffering. You can also set up monitoring of your database server to identify areas where queries are failing. These tests are often simple to set up and can help you identify areas where optimization may be possible.

You can now focus on writing clean, maintainable code, after all the progress made in programming languages, and frameworks. The underlying system should take care of optimizing itself. Only do performance optimizations when you feel it is necessary. Performance tests will show you exactly where to update.

We use cookies to give you tailored experiences on our website. Talk to us for COVID19 Support
Okay