Re: [xslt] Isn't it time to make libxslt multi-threaded?

On 26/07/2012 16:32, Дмитрий Грибов wrote:
    Yes, due to the functional nature of XSLT, xsl:for-each and
    xsl:apply-templates can be parallelized automatically. It would make
    for an interesting project, but I doubt you'll find someone who
    wants to implement this on top of libxslt. I think that most users
    of libxslt don't need lower latency for processing of a single

And that's strange, I tell you. I've seing some laggy xslt-based sites
and one of the most importaint problems with xslt on the web is
performance and responsivness.

Quite a while ago, I did extensive performance comparisons of many Perl based templating solutions and I found libxslt to be faster than all of them, at least when using compiled stylesheets. So I guess the sites you're talking about are doing something wrong or have performance problems in other areas.

    You wrote that you process "a huge and dedicated xml". Do you by
    chance load a large XML file with the "document" function? That's
    the only situation where I ran into performance problems in the
    past, because the parsed XML file won't be cached across

Our XML isn't that "large" to make things painfull, about 100kb - 500kb.
And there is no way (at least I see none) to cache anything except XML
as text fragments and then feed concatenation to "parse_string" (what we
really do most of the time). Not too elegand, but parse_string() takes
less than ~0.01s and I know what I'm paying for. I doubt I can get more
of it without breaking the whole data-presentation brilliance to peaces.

Yes, with Perl I found that creating the XML input document with simple string concatenation and then calling parse_string() to be much faster than constructing the document using the DOM-like functions of libxml. Using this technique and compiled stylesheets, the XSLT transformation of a typical web page takes well below 10 milliseconds in my experience.

On the other hand, XSLT is very powerful and can easily be abused for things that should better be done with a real programming language.

Also note that libxslt has profiling support (see xsltproc --profile). That might help with optimizing your stylesheets.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]