the latter varies between linescpython has single integer typeand cpython has both short and long integers this may explain part of the size of the differencebut the results are valid nonetheless noninteger tests yield similar rankings ( floating-point test in the solutions to this part' exercises)and integer math matters-the one and two order of magnitude (power of speedups here will be realized by many real programsbecause integers and iterations are ubiquitous in python code these results also differ from the preceding section' relative version speedswhere cpython was slightly quicker than and pypy was quicker overalla figure affirmed by most other tests in this book too apart from the different type of code being timed herethe different coding structure inside timeit may have an effect too-for code strings like those tested heretimeit buildscompilesand executes function def statement string that embeds the test stringthereby avoiding function call per inner loop as we'll see in the next sectionthoughthis appears irrelevant from relative-speed perspective command-line usage the timeit module has reasonable defaults and can be also run as scripteither by explicit filename or automatically located on the module search path with python' - flag (see appendix aall the following run python ( cpython in this mode timeit reports the average time for single - loopin either microseconds (labeled "usec")milliseconds ("msec")or seconds ("sec")to compare results here to the total time values reported by other testsmultiply by the number of loops run- usec here , loops is msecor half second in total timec:\codec:\python \lib\timeit py - "[ * for in range( )] loopsbest of usec per loop :\codepython - timeit - "[ * for in range( )] loopsbest of usec per loop :\codepy - - timeit - - "[ * for in range( )] loopsbest of usec per loop as an examplewe can use command lines to verify that choice of timer call doesn' impact cross-version speed comparisons run in this so far-- uses its new calls by defaultand that might matter if timer precision differs widely to prove that this is irrelevantthe following uses the - flag to force timeit to use time clock in all versionsan option that ' manuals call deprecatedbut required to even the score with prior versions ( ' setting my system path to include pypy here for command brevity) :\codeset path=%path%; :\pypy\pypy- :\codepy - - timeit - - - "[ * for in range( )] loopsbest of usec per loop :\codepy - - timeit - - - "[ * for in range( )] the benchmarking interlude