Created
April 6, 2017 11:58
-
-
Save psrok1/fa0cf1b5ee589bd316fc96709253ec2b 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 time | |
times = [] | |
# for N=10**4 works very well, for 10**6 terminates with segfault | |
N = 10**6 | |
for i in range(100): | |
start = time.time() | |
s = "" | |
for l in range(N): | |
s += str(l) | |
end = time.time() | |
times.append(end - start) | |
print "avg {} ms".format(sum(times)*1000.0/len(times)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment