Skip to content

Instantly share code, notes, and snippets.

@psrok1
Created April 6, 2017 11:58
Show Gist options
  • Save psrok1/fa0cf1b5ee589bd316fc96709253ec2b to your computer and use it in GitHub Desktop.
Save psrok1/fa0cf1b5ee589bd316fc96709253ec2b to your computer and use it in GitHub Desktop.
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