summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2003-02-05 23:13:00 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2003-02-05 23:13:00 (GMT)
commit985eba53f5d1ac45037fbf19b6955c74823c1ded (patch)
treef847567e9468a46df6f0a55b7d437a3697e7f248 /Misc
parentf3f4af55214370e5c6df928e8c8242d14060e204 (diff)
downloadcpython-985eba53f5d1ac45037fbf19b6955c74823c1ded.zip
cpython-985eba53f5d1ac45037fbf19b6955c74823c1ded.tar.gz
cpython-985eba53f5d1ac45037fbf19b6955c74823c1ded.tar.bz2
Small function call optimization and special build option for call stats.
-DCALL_PROFILE: Count the number of function calls executed. When this symbol is defined, the ceval mainloop and helper functions count the number of function calls made. It keeps detailed statistics about what kind of object was called and whether the call hit any of the special fast paths in the code. Optimization: When we take the fast_function() path, which seems to be taken for most function calls, and there is minimal frame setup to do, avoid call PyEval_EvalCodeEx(). The eval code ex function does a lot of work to handle keywords args and star args, free variables, generators, etc. The inlined version simply allocates the frame and copies the arguments values into the frame. The optimization gets a little help from compile.c which adds a CO_NOFREE flag to code objects that don't have free variables or cell variables. This change allows fast_function() to get into the fast path with fewer tests. I measure a couple of percent speedup in pystone with this change, but there's surely more that can be done.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/SpecialBuilds.txt10
1 files changed, 10 insertions, 0 deletions
diff --git a/Misc/SpecialBuilds.txt b/Misc/SpecialBuilds.txt
index f48817f..a4226c9 100644
--- a/Misc/SpecialBuilds.txt
+++ b/Misc/SpecialBuilds.txt
@@ -199,3 +199,13 @@ sprayed to stdout, such as every opcode and opcode argument and values
pushed onto and popped off the value stack.
Not useful very often, but very useful when needed.
+
+---------------------------------------------------------------------------
+CALL_PROFILE introduced for Python 2.3
+
+Count the number of function calls executed.
+
+When this symbol is defined, the ceval mainloop and helper functions
+count the number of function calls made. It keeps detailed statistics
+about what kind of object was called and whether the call hit any of
+the special fast paths in the code.