Author: Wim Lavrijsen <wlavrij...@lbl.gov> Branch: reflex-support Changeset: r45811:bddd0178cf08 Date: 2011-07-21 05:05 -0700 http://bitbucket.org/pypy/pypy/changeset/bddd0178cf08/
Log: merge heads diff --git a/pypy/module/cppyy/test/bench1.py b/pypy/module/cppyy/test/bench1.py --- a/pypy/module/cppyy/test/bench1.py +++ b/pypy/module/cppyy/test/bench1.py @@ -15,7 +15,7 @@ def print_bench(name, t_bench): global t_cppref - print ':::: %s cost: %#6.3fs (%#4dx)' % (name, t_bench, t_bench/t_cppref) + print ':::: %s cost: %#6.3fs (%#4.1fx)' % (name, t_bench, float(t_bench)/t_cppref) def python_loop_offset(): for i in range(NNN): @@ -40,6 +40,14 @@ instance.addDataToInt(i) return i +class PyROOTBench1(PyCintexBench1): + def __init__(self): + import ROOT + self.lib = ROOT.gSystem.Load("./example01Dict_cint.so") + + self.cls = ROOT.example01 + self.inst = self.cls(0) + class CppyyInterpBench1(object): scale = 1 def __init__(self): @@ -47,15 +55,13 @@ self.lib = cppyy.load_lib("./example01Dict.so") self.cls = cppyy._type_byname("example01") - self.inst = self.cls.construct(0) + self.inst = self.cls.get_overload(self.cls.type_name).call(None, cppyy.CPPInstance, 0) def __call__(self): addDataToInt = self.cls.get_overload("addDataToInt") instance = self.inst for i in range(NNN): - #inst.invoke(cls.get_overload("addDataToDouble"), float(i)) - #inst.invoke(cls.get_overload("addDataToInt"), i) - instance.invoke(addDataToInt, i) + addDataToInt.call(instance, None, i) return i class CppyyPythonBench1(object): @@ -89,6 +95,12 @@ print run_bench(cintex_bench1) sys.exit(0) + # special case for PyCintex (run under python, not pypy-c) + if '--pyroot' in sys.argv: + pyroot_bench1 = PyROOTBench1() + print run_bench(pyroot_bench1) + sys.exit(0) + # get C++ reference point if not os.path.exists("bench1.exe") or\ os.stat("bench1.exe").st_mtime < os.stat("bench1.cxx").st_mtime: @@ -111,3 +123,5 @@ print_bench("cppyy python", run_bench(python_bench1)) stat, t_cintex = commands.getstatusoutput("python bench1.py --pycintex") print_bench("pycintex ", float(t_cintex)) + #stat, t_pyroot = commands.getstatusoutput("python bench1.py --pyroot") + #print_bench("pyroot ", float(t_pyroot)) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit