py:match template matching is inefficient
|Reported by:||anonymous||Owned by:||cmlenz|
I noticed that most py:match's are fairly simple: <py:match path="tagname">
But when we got to match, we try to match every single event against a complex path, basically calling each path's _test() method over and over.
Instead I borrowed a play from web browsers: index common paths (i.e. like CSS selectors) and then only match against them. So I keep a dictionary mapping nodenames->py:match templates. Rather than calling _test() against every single py:match, I only call _test() against the paths that matter.
I'm attaching a patch to this bug, which is not quite the final patch.