Chapter 8. Improving Performance – Part One
Let's recap what you learned in the previous chapter. We started with a program that appeared harmless until some parameters were tweaked. This change revealed performance issues. Hence, we performed a search operation (profiling) to catch the culprits (the bottlenecks). Now, let's see what we can do to speed up the application code. To be specific, we will cover the following topics:
- Cutting down the runtime of the Gold Hunt application
- Learning to improve the application performance using the following ways:
- Making changes to the algorithm
- Avoiding the function re-evaluation
- Using the list and dictionary comprehensions
- Using generator expressions
- Using tricks to improve the performance of code involving loops
- Choosing the right data structures
- Discussing the
collections
anditertools
modules briefly
In summary, this chapter will cover several (but not all) techniques to speed up the application. Some of these can be directly...