perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Sergeant <>
Subject Re: a faster html::template?
Date Fri, 09 Sep 2005 14:22:52 GMT
On 8 Sep 2005, at 14:18, Perrin Harkins wrote:

>> Not sure why you say "certainly not". XSLT is very fast and easy to
>> optimise (because it's assignment free) and the C implementations are
>> very quick. Remember that an XSLT transform is executing all its tight
>> loops in C-space, not in perl-space.
> Yes, but HTML::Template doesn't do any parsing when executing a
> template.  XSLT always has to parse XML, and then take some pains to
> generate well-formed XML.  I admit that it's possible that an XML 
> parser
> could be written that is so fast that it actually beats the speed of
> accessing variables in perl, but it seems very unlikely.

It depends what architecture you use. You have to compare 
like-with-like. XSP in AxKit is perl code that executes to build a DOM 
tree, not a XML string, so there's no parsing involved - it's just 
iterating over a data structure. And it's very fast.

To give a counter example using XML strings though, I produce the AxKit 
mailing list archives from a static XML file containing around 10k 
records. If I time this:

xsltproc --stringparam month 1 --stringparam year 2005 
../stylesheets/archive-pickmonth.xsl index.xml | xsltproc 
../stylesheets/archive-thread.xsl - | xsltproc 
../stylesheets/archive-gather-orphans.xsl - | xsltproc 
../stylesheets/archive-sort.xsl - | xsltproc 
../stylesheets/archive-display.xsl -

That's 5 XSLT stylesheets, which means parsing XML five times, and 
spawning 5 processes to do this. It executes in 0.75s on my server.

Now to achieve this you have to know how to use XSLT, including using 
things like keys() to get efficient indexing, but I think you can see 
that it's very quick indeed.


View raw message