Last active
December 10, 2015 05:48
-
-
Save ubershmekel/4389657 to your computer and use it in GitHub Desktop.
Test startup times for python2.7 vs python3.3
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/python2.7 | |
""" | |
Outputs on my PC: | |
"python2.7 startup_times.py nop" min run 0.019732 seconds | |
"python3.3 startup_times.py nop" min run 0.026251 seconds | |
""" | |
import subprocess | |
import time | |
import sys | |
if len(sys.argv) > 1: | |
exit() | |
def test(line): | |
res = [] | |
for i in range(20): | |
start = time.time() | |
subprocess.check_call(line, shell=True) | |
end = time.time() | |
res.append(end - start) | |
#print(res) | |
print('"%s" min run %f seconds' % (line, min(res))) | |
test('python2.7 startup_times.py nop') | |
test('python3.3 startup_times.py nop') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment