Skip to Content
Hands-On Software Engineering with Python
book

Hands-On Software Engineering with Python

by Nimesh Verma, Brian Allbee
October 2018
Beginner to intermediate
736 pages
17h 39m
English
Packt Publishing
Content preview from Hands-On Software Engineering with Python

Some testing setup

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Software Architecture with Python

Software Architecture with Python

Anand Balachandran Pillai
Data Structures and Algorithms in Python

Data Structures and Algorithms in Python

Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser

Publisher Resources

ISBN: 9781788622011Supplemental Content