Measuring performance
Now that we've had an overview of what performance complexity is and also of performance testing and measurement tools, let us take an actual look at the various ways of measuring performance complexity with Python.
One of the simplest time measurements can be done by using the time
command of a POSIX/Linux system.
This is done by using the following command line:
$ time <command>
For example, here is a screenshot of the time it takes to fetch a very popular page from the Web:
See that it shows three classes of time output, namely real
, user
, and sys
. It is important to know the distinction between these three so let us look at them briefly:
real
: Real time is the actual wall clock time that elapsed for the operation. This is the time of the operation from start to finish. It will include any time the process sleeps or spends blocked – such as time taken for I/O to complete.User
: User...