timing Your Python Functions
Some dirty little Python code to measure the time of execution of your functions.
def timing(function, args): from time import time start = time() function(*args) return time() - start
The parameter
function
takes the function's name you want to time and the parameter
args
takes a list of the arguments you want to pass to the function. During the function call, the argument list is unpacked using the
*args
. Just put this function and import whatever module you put your common utilities into. This generally proves to be a handy tool when solving for online judges.







