Using architectural trade-offs

When your code cannot be improved any further by reducing the complexity or choosing the proper data structure, a good approach may be to consider doing some trade-offs. If we review user problems and define what is really important for them, we can relax some of the application requirements. The performance can often be improved by:

  • Replacing exact solution algorithms with heuristics and approximation algorithms
  • Deferring some work to delayed task queues
  • Using probabilistic data structures

Using heuristics and approximation algorithms

Some algorithmic problems simply don't have good state of the art solutions that could run in time acceptable to the user. For example, consider a program that deals with some complex ...

Get Expert Python Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.