Created
December 11, 2019 15:55
-
-
Save dtaivpp/2642a600459b6c36e130352b5c30eb36 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 random | |
from time import time | |
random.seed(time()) | |
times = {'listComprehension': 0, 'append': 0, 'preAllocate': 0} | |
for i in range(0,100): | |
endRange = random.randint(100_000, 10_000_000) | |
startTime = time() | |
listComprehension = [i for i in range(0, endRange)] | |
endTime = time() | |
times.update({'listComprehension': endTime - startTime}) | |
#Repeat for other methods with same endRange |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment