I understand the concept of what timeit does but I am not sure how to implement it in my code.
timeit
How can I compare two functions, say insertion_sort
insertion_sort
If you want to compare two blocks of code / functions quickly you could do:
import timeit start_time = timeit.default_timer() func1() print(timeit.default_timer() - start_time) start_time = timeit.default_timer() func2() print(timeit.default_timer() - start_time)