Created
November 21, 2018 03:34
-
-
Save stepancheg/b321d8da7d4ee0a5822e258ed7fe543d 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
#!/usr/bin/env python | |
from __future__ import print_function | |
import time | |
s = "" | |
def f(): | |
global s | |
s += "a" | |
t = time.time() | |
for i in xrange(1000000000): | |
f() | |
step = 100000 | |
if i % step == 0: | |
print("{:.4}us".format((time.time() - t) / step * 1000000)) | |
t = time.time() | |
# vim: set ts=4 sw=4 et: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment