[Python-checkins] python/dist/src/Misc SpecialBuilds.txt,1.12,1.13

jhylton@users.sourceforge.net jhylton@users.sourceforge.net
Wed, 05 Feb 2003 15:13:29 -0800


Update of /cvsroot/python/python/dist/src/Misc
In directory sc8-pr-cvs1:/tmp/cvs-serv3401/Misc

Modified Files:
	SpecialBuilds.txt 
Log Message:
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.


Index: SpecialBuilds.txt
===================================================================
RCS file: /cvsroot/python/python/dist/src/Misc/SpecialBuilds.txt,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** SpecialBuilds.txt	30 Jul 2002 15:25:57 -0000	1.12
--- SpecialBuilds.txt	5 Feb 2003 23:12:57 -0000	1.13
***************
*** 200,201 ****
--- 200,211 ----
  
  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.