[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob/bench mark.py
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] libvob/bench mark.py |
Date: |
Thu, 24 Apr 2003 08:04:57 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Changes by: Tuomas J. Lukka <address@hidden> 03/04/24 08:04:57
Modified files:
bench : mark.py
Log message:
Working towards allowing non-vs benches
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/bench/mark.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
Patches:
Index: libvob/bench/mark.py
diff -u libvob/bench/mark.py:1.6 libvob/bench/mark.py:1.7
--- libvob/bench/mark.py:1.6 Tue Apr 15 09:54:20 2003
+++ libvob/bench/mark.py Thu Apr 24 08:04:57 2003
@@ -8,6 +8,7 @@
import sys
sys.path.insert(0, ".")
import vob
+import vob.util
import sys, types, traceback
@@ -35,7 +36,7 @@
return _flattenArgLists(args, key)
return [args]
-def run(sceneFunc, args):
+def runVSBench(sceneFunc, args):
"""Run the given benchmark with the arguments.
The sceneFunc is assumed to take parameters
@@ -71,14 +72,35 @@
print ms, "ms with ",iters," in ",total
print 1000.0 / ms,"per second\n"
+def runPureBench(func, args):
+ for ar in _argLists(args):
+ # Precompile for JIT
+ func(1, ar)
+ func(1, ar)
+ func(1, ar)
+
+ total = 0
+ iters = 1
+ while total < 2.0:
+ iters *= 2
+ (total, str) = func(iters, **ar)
+ ms = total / iters * 1000
+ print str
+ print ms, "ms with ",iters," in ",total
+ print 1000.0 / ms,"per second\n"
+
+
if __name__ == "__main__":
import getopt
+ print dir(vob)
+ print dir(vob.putil)
+ print dir(vob.util)
opts, args = getopt.getopt(sys.argv[1:],
- vob.util.dbg.short,
- vob.util.dbg.long)
+ vob.putil.dbg.short,
+ vob.putil.dbg.long)
for o,a in opts:
print "Opt: ",o,a
- vob.util.dbg.option(o,a)
+ vob.putil.dbg.option(o,a)
# testmod = "bench.vob.text.overhead"
# testmod = "bench.vob.paper.dice"
@@ -92,7 +114,10 @@
def run(self):
exec "import "+testmod+"\ntestmod = "+testmod+"\n"
try:
- run(testmod.benchScene, testmod.args)
+ if hasattr(testmod, "benchScene"):
+ runVSBench(testmod.benchScene, testmod.args)
+ else:
+ runPureBench(testmod.bench, testmod.args)
except:
typ, val, tra = sys.exc_info()
print (repr((typ, val)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] libvob/bench mark.py,
Tuomas J. Lukka <=