xsl-list
[Top] [All Lists]

Re: controller stylsheet. performance, best practices question

2003-04-23 00:40:48
Terence Kearns <terencek(_at_)isd(_dot_)canberra(_dot_)edu(_dot_)au> wrote:

My questions is:
Is taking this sort of approach prone to big performance problems?
I can see that in many cases, most of the templates imported at the
top of the style sheet will not even be used. They can't be included on the fly because they need to be top-level (can't be nested inside IF or CHOOSE).*

In most cases, there wouldn't be any problem with this. Including more
statically is often less demanding than selective dynamic including.
The file-server have your files in cache (especially if used a lot).
The effective thing would be the XSLT parsers ability to quickly
parse the templates, but I don't think these performance penalties
will outweight penalties in dynamic libraries.

Since you use PHP, I'm suspecting you using the Sablotron parser,
and my experiance with this parser is that it is *very* fast in its
parsing. I would be more concerned with the XPath expressions
within which is where most performance penalties comes from.

But then, what you need to work out is a) how often will your templates
be called? (what is your traffic?), and b) is the technology chosen
the right one for the job. You'd be amazed what can be achieved with
some fancy XSLT, but that doesn't make it clever to do so. Same goes
for PHP; it isn't the fastest beast around, so if your system is
expecting high traffic, compiled PHP (or some other technology) might
be in order. Maybe just plain HTML could do the trick? Nothing beats
plain HTML in performance. :)

* I could probably use PHP code to include it on the fly, but I want to avoid doing so because I've made a rule for myself not to use server-side code embedded in the stylesheet. I've done so in the param of this example for purposes of clarity, normally I would send them to the processor directly from the PHP function call.

I wouldn't bother much with this approach; it isn't worth it. As with
any project you work on, Keep It Simple. Simple strategies to problems is often also the fastest way to solve them. Simplicity
is underrated. :)


Regards,

Alexander
--
___________________ ______________________ _____________________________
                  |                      |
http://shelter.nu/ | alex at shelter . nu | http://shelter.nu/xsiteable/
___________________|______________________|_____________________________

XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list