E&S CVS Commit: PyProtocols - Create a fast path for argument retrieval expressions, resulting in an

pje at eby-sarna.com pje at eby-sarna.com
Tue Jan 25 21:23:00 EST 2005


Module Name:	PyProtocols
Committed By:	pje
Date:		Wed Jan 26 02:22:17 UTC 2005

Modified Files:
	PyProtocols/src/dispatch: functions.py interfaces.py strategy.py
	PyProtocols/src/protocols: _speedups.c
	PyProtocols/src/protocols/tests: test_dispatch.py

Log Message:
Create a fast path for argument retrieval expressions, resulting in an
overall 33% reduction of overhead for a single-argument generic function
(and a higher percent improvement for multi-argument functions).  This
change avoids creating an expression cache when there are no expressions
other than the arguments themselves being tested, and avoids the need for
additional function calls when an expression is a plain argument.  This
is a pretty decent speedup considering it doesn't use any new C code, but
any further speedups of this fast path are probably going to need C, as
we're down to shaving microseconds now.  About the only other thing we
could do would be to rework the dispatch algorithm to be lock-free, so that
we could trim a microsecond or so by not needing to lock the dispatcher.
After that, all the improvements we can make are by using C to avoid
attribute lookups and Python function calls.


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.23&r2=1.24
http://cvs.eby-sarna.com/PyProtocols/src/dispatch/interfaces.py.diff?r1=1.11&r2=1.12
http://cvs.eby-sarna.com/PyProtocols/src/dispatch/strategy.py.diff?r1=1.17&r2=1.18
http://cvs.eby-sarna.com/PyProtocols/src/protocols/_speedups.c.diff?r1=1.13&r2=1.14
http://cvs.eby-sarna.com/PyProtocols/src/protocols/tests/test_dispatch.py.diff?r1=1.30&r2=1.31

To generate a diff of this commit:
cvs rdiff -r1.23 -r1.24 PyProtocols/src/dispatch/functions.py
cvs rdiff -r1.11 -r1.12 PyProtocols/src/dispatch/interfaces.py
cvs rdiff -r1.17 -r1.18 PyProtocols/src/dispatch/strategy.py
cvs rdiff -r1.13 -r1.14 PyProtocols/src/protocols/_speedups.c
cvs rdiff -r1.30 -r1.31 PyProtocols/src/protocols/tests/test_dispatch.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