Leveraging architectural trade-offs
When your code can no longer be improved by reducing the complexity or choosing a proper data structure, a good approach may be to consider a trade-off. If we review users' problems and define what is really important to them, we can often relax some of the application's requirements. Performance can often be improved by doing the following:
- Replacing exact solution algorithms with heuristics and approximation algorithms
- Deferring some work to delayed task queues
- Using probabilistic data structures
Let's move on and take a look at these improvement methods.
Using heuristics and approximation algorithms
Some algorithmic problems simply don't have good state-of-the-art solutions that could run within a time span that would be acceptable to the user.
For example, consider a program that deals with complex optimization problems, such as the Traveling Salesman Problem (TSP) or the Vehicle...