Skip to content

Instantly share code, notes, and snippets.

@ubershmekel
Last active December 10, 2015 05:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ubershmekel/4389657 to your computer and use it in GitHub Desktop.
Save ubershmekel/4389657 to your computer and use it in GitHub Desktop.
Test startup times for python2.7 vs python3.3
#!/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