[Zope3-checkins] CVS: Zope3/src/zope/tal - talinterpreter.py:1.15
Fred L. Drake, Jr.
fred@zope.com
Tue, 8 Apr 2003 11:40:44 -0400
Update of /cvs-repository/Zope3/src/zope/tal
In directory cvs.zope.org:/tmp/cvs-serv11062
Modified Files:
talinterpreter.py
Log Message:
attrAction_tal(): Merge the commonest case of a short path through
attrAction() directly into attrAction_tal() to avoid a method
call. This is the most common path in the existing benchmarks,
and cuts out a lot of method calls.
=== Zope3/src/zope/tal/talinterpreter.py 1.14 => 1.15 ===
--- Zope3/src/zope/tal/talinterpreter.py:1.14 Tue Apr 8 05:32:21 2003
+++ Zope3/src/zope/tal/talinterpreter.py Tue Apr 8 11:40:44 2003
@@ -321,7 +321,13 @@
def attrAction_tal(self, item):
name, value, action = item[:3]
if action in ('metal', 'tal', 'xmlns', 'i18n'):
- return self.attrAction(item)
+ if not self.showtal:
+ # This shortcuts a common case that's also handled by
+ # the short path in .attrAction(); this avoids a
+ # method call that gets called too often.
+ return 0, name, value
+ else:
+ return self.attrAction(item)
ok = 1
expr, xlat, msgid = item[3:]
if self.html and name.lower() in BOOLEAN_HTML_ATTRS: