Ian Bicking: the old part of his blog

Events and sqlobject comment 000

"""RuleDispatch also isn't as efficient if you are subscribing to instances instead of classes"""

Actually, I spoke too briefly. RuleDispatch is actually more efficient if you're subscribing to instances, as long as the set of instances involved is relatively static. It's just that if you are adding new instances to subscribe to all the time, then it can cost a lot to keep rebuilding the dispatch tree. However, if you just add a bunch of rules at application startup and then call them, RuleDispatch can be more efficient than PyDispatcher, if the subscribers have overlapping conditional tests taking place. (Because RuleDispatcher evaluates each conditional subexpression at most once, whereas PyDispatcher subscribers can't take advantage of tests evaluated by other subscribers.) This is particularly impactful if any of the tests involve query execution.

Comment on Re: Events and SQLObject
by Phillip J. Eby