[pypy-svn] r76062 - pypy/branch/reflex-support/pypy/module/cppyy/test
arigo at codespeak.net
arigo at codespeak.net
Fri Jul 9 11:10:29 CEST 2010
Author: arigo
Date: Fri Jul 9 11:10:27 2010
New Revision: 76062
Added:
pypy/branch/reflex-support/pypy/module/cppyy/test/bench1.py
Log:
A benchmark.
Added: pypy/branch/reflex-support/pypy/module/cppyy/test/bench1.py
==============================================================================
--- (empty file)
+++ pypy/branch/reflex-support/pypy/module/cppyy/test/bench1.py Fri Jul 9 11:10:27 2010
@@ -0,0 +1,26 @@
+
+import time
+import cppyy
+lib = cppyy.load_lib("./example01Dict.so")
+cls = cppyy._type_byname("example01")
+inst = cls.construct(0)
+
+def g():
+ res = 0
+ for i in range(10000000):
+ i
+
+def f():
+ res = 0
+ for i in range(10000000):
+ #inst.invoke("addDataToDouble", float(i))
+ inst.invoke("addDataToInt", i)
+
+g(); f();
+t1 = time.time()
+g()
+t2 = time.time()
+f()
+t3 = time.time()
+print t3 - t2, t2 - t1
+print (t3 - t2) - (t2 - t1)
More information about the Pypy-commit
mailing list