Basically, I want to be able to output the elapsed time that the application is running for. I think I need to use some sort of timeit function but I'm not sure which one. I'm looking for something like the following...
START MY TIMER code for application more code more code etc STOP MY TIMER
OUTPUT ELAPSED TIME to do the above code in between start and stop of timer. Thoughts?
Why is Python slow? The default implementation of Python 'CPython' uses GIL (Global Interpreter Lock) to execute exactly one thread at the same time, even if run on a multi-core processor as GIL works only on one core regardless of the number of cores present in the machine.
This can literally run forever. The Python garbage collector will free the memory used by A when it's value is overwritten.
The simplest way to do it is to put:
import time start_time = time.time()
at the start and
print "My program took", time.time() - start_time, "to run"
at the end.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With