E&S CVS Commit: PyProtocols - Performance booster for setting up large dispatch tables when all possible

pje at eby-sarna.com pje at eby-sarna.com
Tue Dec 7 12:18:00 EST 2004


Module Name:	PyProtocols
Committed By:	pje
Date:		Tue Dec  7 17:17:39 UTC 2004

Modified Files:
	PyProtocols/src/dispatch: functions.py interfaces.py predicates.py
	    strategy.py

Log Message:
Performance booster for setting up large dispatch tables when all possible
matches are statically known.  Tests must now have a 'matches(table)'
method that iterates all keys in 'table' that match that test.  It's
a prerequisite that the test's 'seeds' have already been entered in the
table, so if all the test's matches are known, it can simply return them
without actually iterating over the table.  This should boost performance
significantly for adding methods with lots of distinct '==' tests, although
there are still lots of other O(N) or O(N^2) algorithms here.  Anyway, if
you wrote your own ITest classes, you need to add a 'matches()' method.
You can swipe the one from dispatch.strategy.ProtocolTest if you need an
example of a test whose matches can't be determined statically.


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.15&r2=1.16
http://cvs.eby-sarna.com/PyProtocols/src/dispatch/interfaces.py.diff?r1=1.8&r2=1.9
http://cvs.eby-sarna.com/PyProtocols/src/dispatch/predicates.py.diff?r1=1.5&r2=1.6
http://cvs.eby-sarna.com/PyProtocols/src/dispatch/strategy.py.diff?r1=1.6&r2=1.7

To generate a diff of this commit:
cvs rdiff -r1.15 -r1.16 PyProtocols/src/dispatch/functions.py
cvs rdiff -r1.8 -r1.9 PyProtocols/src/dispatch/interfaces.py
cvs rdiff -r1.5 -r1.6 PyProtocols/src/dispatch/predicates.py
cvs rdiff -r1.6 -r1.7 PyProtocols/src/dispatch/strategy.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