In order to optimize a program, I want a simple function to show me the exact (or aprox.) speed and memory needed by a function:
measuring("start")
fu()
measuring("stop")
In order to optimize a program, I want a simple function to show me the exact (or aprox.) speed and memory needed by a function:
measuring("start")
fu()
measuring("stop")
You can use datetime to calculate speed:
from datetime import datetime
startTime = datetime.now()
print(datetime.now() - startTime)
Output: 0:00:00.000007
Just wrap that around your function to time it :).