Venus thoughts
Sam Ruby
rubys at intertwingly.net
Tue Oct 10 17:05:46 EST 2006
Jeff Waugh wrote:
> <quote who="Sam Ruby">
>
>> For memory constrained environments, XSLT may turn out to be be preferred.
>
> Wow, really? Why is that? (Seems counter-intuitive.)
Does seem counter intuitive, but libxml2 and related components are
blazingly fast. Also, I'm starting from a normalized XML representation
that I simply concatenate and pass to XSLT. For HTMLTMPL, I need to
build a second dictionary based representation of the input data
structures. Finally, that data structure must contain everything that
might be referenced, including dates in several formats.
Disclaimer: I have not measured memory consumption. All I know is that
on my machine, there is a small but human noticeable pause between
templates invocations when HTMLTMPL is used; by contrast, there is no
perceptible delay between template invocations when XSLT is used.
As a final footnote: libxml2 is noticeably faster than the default
minidom implementation, but isn't installed by default in Python, so
I've stuck with mindom. I did prototype building an encapsulation layer
so that Venus would use libxml2 when it was available, but fall back to
minidom. On the test I tried it with, there was about a 33% reduction
in elapsed time. This may merit additional exploration, but I didn't
commit that change at the time.
It may very well turn out that no xml parser is required at all in the
splice phase -- everything is normalized, so I should be able to simply
strcat the entries and then wrap them in a feed.
- Sam Ruby
More information about the devel
mailing list