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 range(self.rounds):
103
def h(a,b,c,d=1,e=2,f=3):
107
for i in range(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 range(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 range(self.rounds):
170
class BuiltinFunctionCalls(Test):
173
operations = 5*(2+5+5+5)
185
for i in range(self.rounds):
286
for i in range(self.rounds):
291
class PythonMethodCalls(Test):
294
operations = 5*(6 + 5 + 4)
322
for i in range(self.rounds):
428
for i in range(self.rounds):
433
class Recursion(Test):
449
for i in range(self.rounds):
466
for i in range(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,