October 2018
Beginner to intermediate
736 pages
17h 39m
English
It may be useful to capture some runtime information for a sample set of numbers, say from 10,000,000 to 10,001,000, capturing both the total runtime and the average time per number. A simple script (serial_baseline.py), executing the factors_of function against each of those numbers one at a time (serially), is easily assembled:
#!/usr/bin/env python """serial_baseline.py Getting data that we can use to estimate how long a factor_of call will take for some sample "large" numbers. """ print( '# Execution of %s, using all of one CPU\'s capacity' % __file__ ) print('='*80) print() import time from factors import factors_of # - The number we'll start with range_start = 10000000 # - The number of calls we'll make to the function ...