[pypy-commit] extradoc extradoc: import the benchmark

fijal noreply at buildbot.pypy.org
Fri Jul 1 11:42:08 CEST 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: extradoc
Changeset: r3815:3d56fe3ca53b
Date: 2011-07-01 11:42 +0200
http://bitbucket.org/pypy/extradoc/changeset/3d56fe3ca53b/

Log:	import the benchmark

diff --git a/talk/ctpug2011/src/count.py b/talk/ctpug2011/src/count.py
new file mode 100644
--- /dev/null
+++ b/talk/ctpug2011/src/count.py
@@ -0,0 +1,23 @@
+import sys
+import time
+
+def count_mult_of_5(N):
+    mult = 0
+    not_mult = 0
+    for i in range(N):
+        if i % 5 == 0:
+            mult += 1
+        else:
+            not_mult += 1
+    return mult, not_mult
+
+def main():
+    N = int(sys.argv[1])
+    start = time.clock()
+    count = count_mult_of_5(N)
+    end = time.clock()
+    print 'count: ', count
+    print 'time:', end-start, 'secs'
+
+if __name__ == '__main__':
+    main()


More information about the pypy-commit mailing list