]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.2/Tools/pybench/Calls.py
1 from pybench
import Test
3 class PythonFunctionCalls(Test
):
6 operations
= 5*(1+4+4+2)
23 def h(a
,b
,c
,d
=1,e
=2,f
=3):
27 for i
in xrange(self
.rounds
):
103 def h(a
,b
,c
,d
=1,e
=2,f
=3):
107 for i
in xrange(self
.rounds
):
112 class ComplexPythonFunctionCalls(Test
):
121 def f(a
,b
,c
,d
=1,e
=2,f
=3):
125 kwargs
= dict(c
=3,d
=4,e
=5)
128 for i
in xrange(self
.rounds
):
130 f(f
=i
,e
=i
,d
=i
,c
=2,b
=i
,a
=3)
135 f(f
=i
,e
=i
,d
=i
,c
=2,b
=i
,a
=3)
140 f(f
=i
,e
=i
,d
=i
,c
=2,b
=i
,a
=3)
145 f(f
=i
,e
=i
,d
=i
,c
=2,b
=i
,a
=3)
150 f(f
=i
,e
=i
,d
=i
,c
=2,b
=i
,a
=3)
158 def f(a
,b
,c
,d
=1,e
=2,f
=3):
162 kwargs
= dict(c
=3,d
=4,e
=5)
165 for i
in xrange(self
.rounds
):
170 class BuiltinFunctionCalls(Test
):
173 operations
= 5*(2+5+5+5)
185 for i
in xrange(self
.rounds
):
286 for i
in xrange(self
.rounds
):
291 class PythonMethodCalls(Test
):
294 operations
= 5*(6 + 5 + 4)
322 for i
in xrange(self
.rounds
):
428 for i
in xrange(self
.rounds
):
433 class Recursion(Test
):
449 for i
in xrange(self
.rounds
):
466 for i
in xrange(self
.rounds
):
470 ### Test to make Fredrik happy...
472 if __name__
== '__main__':
475 timeit
.TestClass
= PythonFunctionCalls
476 timeit
.main(['-s', 'test = TestClass(); test.rounds = 1000',
492 def h(a,b,c,d=1,e=2,f=3):
559 timeit
.main(['-s', setup
,