Search

Hi,

do you prefer to create dynamic string outputs using multiple <xsl:text> elements and value-of tags, or with a select="concat('string1', /data..., 'string2')" syntax?

Which style has a better XSLT build performance?

I am aware, that most performance comes from proper datasources, but speaking of XSLT...

Brian Zerangue pointed me to this article, XSLT Tips for Cleaner Code and Better Performance, which recommends the built-in concat() function.

Do you have a verification that concat() performs better? The article doesn't reference a source and I have to say that I normally don't use concat() because – personally – I find it harder to read.

I'd say that if you use Symphony, XSLT will be fast enough anyway. We know that the main bottleneck are the database queries (which have already been otimized a lot) and the built-in custom DOM functions (which are on the list, AFAIK).

I have a lot of pages with around 10000 lines of XML, transformed in 0.06 seconds. Compare this to the debugger's Page Built value of 0.4 seconds! The latter would even be much higher if I was building the whole XML from scratch — I use long fractions of XML here stored in custom fields.

That said, I would also be interested in some comparisons. :-) (Unlike Nils, I started using concat() a lot more recently.)

[EDIT]: Before you ask: Yes, parts of Symphony's debugger are very slow with 10000 lines of XML. :-(

[EDIT 2]: Fixed number of lines. Actually it's around 10000 lines.

IMO, these kinds of optimisations are completely useless. If you were to measure how much time either method takes you'll find you have to execute them millions of times to produce a noticable result.

Since you'll have other problems when you need to execute them that many times, this is not something you should worry about.

I was about to say something similar.

It's so small in time measurement that you probably would never notice it.

Vuav, thanks for your insights.

Yes, XSLT its not the mayor issue but feature :) If not in terms of performance, I think it is a great time-saver to write XSLT more efficiency or properly and also more nice to view and cooperate with others.

Concerning "XSLT performance" I also red this article of the same author about not to indent the output, which speed-up transform time and reduces the data size.

And to add, here in forum are also some good points - I red it some time ago, but wanted to ask more on this string concating, which can be done in maybe 3 ways or so.

Thank you.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details