Created
July 12, 2019 13:27
-
-
Save funnydman/b52d8165ce739653869f99b7bc94790f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import timeit | |
setup = ''' | |
import random | |
random.seed('slartibartfast') | |
s = [random.random() for i in range(1000)] | |
timsort = list.sort | |
''' | |
print(min(timeit.Timer('a=s[:]; timsort(a)', setup=setup).repeat(7, 1000))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With IPython:
With plain interpreter:
https://stackoverflow.com/questions/8220801/how-to-use-timeit-module