Created
March 14, 2010 12:07
-
-
Save berry/331935 to your computer and use it in GitHub Desktop.
This file contains 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
# Testing IO with pypy-c-jit | |
import sys | |
import datetime | |
def readfile(filename): | |
f = open(filename, 'r') | |
html = f.read() | |
f.close() | |
if __name__ == "__main__": | |
filename = "test.html" | |
loopcount = int(sys.argv[1]) or 10 | |
print "Number of loops: %s" % loopcount | |
t0 = datetime.datetime.now() | |
for i in range(loopcount): | |
readfile(filename) | |
t1 = datetime.datetime.now() | |
print t1 - t0 | |
# Results on my linux/ubuntu dev machine | |
# With pypy-1.2 downloaded from pypy.org | |
# | |
# ~$ pypy-c test2.py 10000 | |
# Number of loops: 10000 | |
# 0:00:06.614613 | |
# | |
# ~$ python test2.py 10000 | |
# Number of loops: 10000 | |
# 0:00:00.698342 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment