templates

Richie Hindle richie at entrian.com
Tue Jan 31 06:31:49 EST 2006


[Christoph]
> The reason why [PyMeld] is slower than native templates seems clear: You 
> convert the whole page to objects in memory, and then serialize 
> everything back to HTML.

[Peter]
> Unless I'm misremembering, PyMeld is special amongst the "total 
> decoupling of code and presentation" crowd in that it does *not* convert 
> the whole page to objects in memory, but instead performs its operations 
> using regular-expression substitution, and serializing back to HTML is a 
> trivial operation since it's already serialized.

Peter is right for PyMeld, Christoph is right for PyMeldLite (which is a
variant of PyMeld used by Spambayes, and only works with valid XHTML).

The performance of PyMeld therefore depends on how much work you make it do -
if you insert a couple of values into a page, it's very fast.  If you do lots
and lots of operations on the whole of a large page, it can be very slow
because it's doing complex regular expression operations on a large string.
(It works this way because two of its design goals were to only touch the
parts of the page you ask it to touch, and to work with arbitrary, possibly
invalid, HTML.)

Incidentally, I'm changing PyMeld's license from Sleepycat to BSD, making it
free for use in closed source projects.  (I'll get around to updating the
website RSN 8-)

-- 
Richie Hindle
richie at entrian.com



More information about the Python-list mailing list