E&S CVS Commit: PyProtocols - Almost two more microseconds gone... off all paths, not just the fast one!

pje at eby-sarna.com pje at eby-sarna.com
Mon Feb 7 20:19:00 EST 2005


Module Name:	PyProtocols
Committed By:	pje
Date:		Tue Feb  8 01:18:12 UTC 2005

Modified Files:
	PyProtocols/src/dispatch: functions.py

Log Message:
Almost two more microseconds gone...  off all paths, not just the fast one!
The first trick, accounting for about half the gain, was to change the
generated code for generic function wrappers so that it calls the
dispatcher's __getitem__ directly, allowing Python to skip an attribute
lookup and take advantage of the interpreter's fast path for calls to
bound methods written in Python.  The second trick was to change from
using lazy DispatchNode objects to 4-item lists that contain either 'None'
or a filled-out DispatchNode in one of the values.  This avoids needing an
attribute lookup in order to determine whether the node needs populating.
It also avoids a type test on the dispatch loop.


To view diffs of this commit, you can use the following URL(s):
http://cvs.eby-sarna.com/PyProtocols/src/dispatch/functions.py.diff?r1=1.30&r2=1.31

To generate a diff of this commit:
cvs rdiff -r1.30 -r1.31 PyProtocols/src/dispatch/functions.py

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




More information about the source-changes mailing list