[Zope] - cDocumentTemplate slower than pDocumentTemplate?

Phillip J. Eby pje@telecommunity.com
Thu, 10 Dec 1998 17:57:40 -0500


Here's a bit of weirdness for you.  Today I compiled cDocumentTemplate and
dropped it into a Python library to see what impact it would have on some
very intensive DTML in an application of mine...  and it actually *slowed
down slightly*.

I couldn't believe it, so I started doing all sorts of tests.  I should
note, however, that my 'pDocumentTemplate' has been patched to use the C
version of MultiMapping from the ExtensionClass kit rather than the Python
MultiMapping.  Anyhow, here are some of the results:

pDocumentTemplate: ~9 seconds of CPU
cDocumentTemplate: ~12 seconds of CPU
pDocumentTemplate + render_blocks from cDocumentTemplate: ~8 seconds of CPU
Same, with -X option to Python: ~7 seconds of CPU

I noticed that there were often dramatic differences in speed depending on
whether -X was used.  It seems that Python 1.5's class-based built-in
exceptions can be hell on DocumentTemplates (and presumably upon
Acquisition as well).

Any ideas why cDocumentTemplate's InstanceDict and TemplateDict would run
slower than the Python versions (given a C MultiMapping)?