diff options
Diffstat (limited to 'Tools/pybench/Calls.py')
-rw-r--r-- | Tools/pybench/Calls.py | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Tools/pybench/Calls.py b/Tools/pybench/Calls.py index 72ccd0e..e27798b 100644 --- a/Tools/pybench/Calls.py +++ b/Tools/pybench/Calls.py @@ -109,6 +109,64 @@ class PythonFunctionCalls(Test): ### +class ComplexPythonFunctionCalls(Test): + + version = 2.0 + operations = 4*5 + rounds = 100000 + + def test(self): + + # define functions + def f(a,b,c,d=1,e=2,f=3): + return f + + args = 1,2 + kwargs = dict(c=3,d=4,e=5) + + # do calls + for i in xrange(self.rounds): + f(a=i,b=i,c=i) + f(f=i,e=i,d=i,c=2,b=i,a=3) + f(1,b=i,**kwargs) + f(*args,**kwargs) + + f(a=i,b=i,c=i) + f(f=i,e=i,d=i,c=2,b=i,a=3) + f(1,b=i,**kwargs) + f(*args,**kwargs) + + f(a=i,b=i,c=i) + f(f=i,e=i,d=i,c=2,b=i,a=3) + f(1,b=i,**kwargs) + f(*args,**kwargs) + + f(a=i,b=i,c=i) + f(f=i,e=i,d=i,c=2,b=i,a=3) + f(1,b=i,**kwargs) + f(*args,**kwargs) + + f(a=i,b=i,c=i) + f(f=i,e=i,d=i,c=2,b=i,a=3) + f(1,b=i,**kwargs) + f(*args,**kwargs) + + + def calibrate(self): + + # define functions + def f(a,b,c,d=1,e=2,f=3): + return f + + args = 1,2 + kwargs = dict(c=3,d=4,e=5) + + # do calls + for i in xrange(self.rounds): + pass + +### + class BuiltinFunctionCalls(Test): version = 2.0 |