4 Answers
+ 7
You can also use module timeit from python. This statement is from stackoverflow:
timeit is more accurate (compared to time module), for three reasons:
- it repeats the tests many times to eliminate the influence of other tasks on your machine, such as disk flushing and OS scheduling.
- it disables the garbage collector to prevent that process from skewing the results by scheduling a collection run at an inopportune moment.
- it picks the most accurate timer for your OS, time.time or time.clock in Python 2 and time.perf_counter() on Python 3. See timeit.default_timer.
+ 2
And how can we know the memory used
+ 1
using time or datetime modules you can see the speed of a program. Just make two time objects (one at the start and one at the end) and subtract them.