This chapter was all about performance. At the start of the chapter, we discussed performance and SPE. We looked at the two categories of performance testing and diagnostic tools – namely, stress testing tools and profiling/instrumentation tools.
We then discussed what performance complexity really means in terms of the Big-O notation and discussed briefly the common time orders of functions. We looked at the time taken by functions to execute and learned the three classes of time usage – namely real
, user
, and sys
in POSIX systems.
We moved on to measuring performance and time in the next section – starting with a simple context manager timer and moving on to more accurate measurements using the timeit
module. We measured the time taken for certain algorithms for a range of input sizes. By plotting the time taken against the input size and superimposing it on the standard time complexity graphs, we were able to get a visual understanding of the performance complexity of functions...