summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2008-07-25 22:39:39 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2008-07-25 22:39:39 (GMT)
commit9a2310d1b6b80bae072892de04464d23b1e88881 (patch)
treed5dbc7ed9faa68fb8c16c11edb9a513a286b36f5 /Tools
parent83d6a87a40711c6012ef856f4a2e6e7b2c30cedf (diff)
downloadcpython-9a2310d1b6b80bae072892de04464d23b1e88881.zip
cpython-9a2310d1b6b80bae072892de04464d23b1e88881.tar.gz
cpython-9a2310d1b6b80bae072892de04464d23b1e88881.tar.bz2
Merged revisions 65240-65242 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r65240 | antoine.pitrou | 2008-07-26 00:02:07 +0200 (sam., 26 juil. 2008) | 3 lines add a pybench test for complex function calls (part of #1819) ........ r65241 | antoine.pitrou | 2008-07-26 00:13:52 +0200 (sam., 26 juil. 2008) | 4 lines Raymond's patch for #1819: speedup function calls with named parameters (35% faster according to pybench) ........ r65242 | antoine.pitrou | 2008-07-26 00:22:08 +0200 (sam., 26 juil. 2008) | 3 lines add a NEWS entry ........
Diffstat (limited to 'Tools')
-rw-r--r--Tools/pybench/Calls.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/Tools/pybench/Calls.py b/Tools/pybench/Calls.py
index cfe0715..7c11867 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 range(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 range(self.rounds):
+ pass
+
+###
+
class BuiltinFunctionCalls(Test):
version = 2.0