13 def endTimer(self
, s
):
14 mps
= 1/(time
.time() - self
.t1
)
15 print "Python %s := %0.2f" % (s
, mps
)
20 for i
in xrange(oneMillion
/8):
21 self
.x
; self
.x
; self
.x
; self
.x
;
22 self
.x
; self
.x
; self
.x
; self
.x
;
23 self
.endTimer("slotAccesses ")
25 def testSetSlot(self
):
28 for i
in xrange(oneMillion
/8):
29 self
.x
= 1; self
.x
= 2; self
.x
= 3; self
.x
= 4;
30 self
.x
= 1; self
.x
= 2; self
.x
= 3; self
.x
= 4;
31 self
.endTimer("slotSets ")
35 for i
in xrange(oneMillion
/8):
36 self
.foo(); self
.foo(); self
.foo(); self
.foo();
37 self
.foo(); self
.foo(); self
.foo(); self
.foo()
38 self
.endTimer("blockActivations ")
40 def testInstantiations(self
):
42 for i
in xrange(oneMillion
/8):
43 Tester(); Tester(); Tester(); Tester();
44 Tester(); Tester(); Tester(); Tester();
45 self
.endTimer("instantiations ")
50 for i
in xrange(oneMillion
/8):
53 self
.endTimer("localAccesses ")
55 def testSetLocals(self
):
58 for i
in xrange(oneMillion
/8):
59 v
= 1; v
= 2; v
= 3; v
= 4;
60 v
= 1; v
= 2; v
= 3; v
= 4;
61 self
.endTimer("localSets ")
72 self
.testInstantiations()
75 print "Python version := \"%i.%i.%i %s %i\"" % sys
.version_info
77 print "// values in millions per second"