473,385 Members | 1,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

XSLT benchmarking and performance advice ?

I've just started on a new project and inherited a huge pile of XSLT
(and I use the term "pile" advisedly !) It runs at glacial speed, and
I need to fix this this.

Platform is MSXML 4 / ASP

Any advice on benchmarking tools / techniques ? I have no budget for
tool-building, so if there's anything already out there, that would be
good to know.

Any general advice on performance bottlenecks to avoid ? Particular
areas I'm interested in are:

* xsl:call-template / name vs. xsl:apply-templates / match / mode

* Large stylesheets loaded from several small stylesheets, aggregated
by use of xsl:import

* Many template rules calling each other in chains, where some are
doing little more than being function calls mapping one rule onto
another.

* Widespread string-slicing with substring-before() etc.
I'm also looking at serious automatic compilation of templates. I can
do some specific tuning by hand, but most of these stylesheets are
automatically generated and there are simply too many of them. does
anyone have experience of either auto-merging stylesheets and trying
to auto-compile the various template rules (I think there are many
cases where only one rule of a group will ever be invoked, owing to
simple scoping rules).

Another compilation option would be to "flatten the call stack" where
three or four templates call each other in turn, but do little output
or logic until the very last step.
Any advice gratefully received !

Jul 20 '05 #1
3 2172
Andy,

You are asking tens of serious questions in a single message...

While all those factors you mentioned could have impact on performance,
there are more serious ones that must be inspected first:

1. Algorithms / data structures -- this alone may change the
transformation time tens of times. See if there are O(N^2) or worse
algorithms and try to implement better ones -- e.g. O(N).

2. Deep recursion, which consumes huge stack space and causes virtual
memory access (thrashing). There are techniques to flatten recursion -- e.g.
DVC (Divide and Conquer -- see for example:

http://www.topxml.com/code/default.a...20020107050418

or to eliminate recursion at all -- see:

http://www.xml.com/pub/a/2003/08/06/exslt.html?page=2

3. Inefficient XPath expressions -- e.g. //someElement

4. Not using xsl:key and the key() function.
5. See also the recommendations of Mike Kay here:

http://aspn.activestate.com/ASPN/Mail/Message/774836
6. Google for xslt performance.

7. Try to understand the problem better and see if the application really
does what it is supposed to do. In many situations it may be more productive
to re-write the application from scratch than to drown in messed code.

Cheers,
Dimitre Novatchev [XML MVP],
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html
"Andy Dingley" <di*****@codesmiths.com> wrote in message
news:2u********************************@4ax.com...
I've just started on a new project and inherited a huge pile of XSLT
(and I use the term "pile" advisedly !) It runs at glacial speed, and
I need to fix this this.

Platform is MSXML 4 / ASP

Any advice on benchmarking tools / techniques ? I have no budget for
tool-building, so if there's anything already out there, that would be
good to know.

Any general advice on performance bottlenecks to avoid ? Particular
areas I'm interested in are:

* xsl:call-template / name vs. xsl:apply-templates / match / mode

* Large stylesheets loaded from several small stylesheets, aggregated
by use of xsl:import

* Many template rules calling each other in chains, where some are
doing little more than being function calls mapping one rule onto
another.

* Widespread string-slicing with substring-before() etc.
I'm also looking at serious automatic compilation of templates. I can
do some specific tuning by hand, but most of these stylesheets are
automatically generated and there are simply too many of them. does
anyone have experience of either auto-merging stylesheets and trying
to auto-compile the various template rules (I think there are many
cases where only one rule of a group will ever be invoked, owing to
simple scoping rules).

Another compilation option would be to "flatten the call stack" where
three or four templates call each other in turn, but do little output
or logic until the very last step.
Any advice gratefully received !

Jul 20 '05 #2
In article <2u********************************@4ax.com>,
Andy Dingley <di*****@codesmiths.com> wrote:

% Any advice on benchmarking tools / techniques ? I have no budget for
% tool-building, so if there's anything already out there, that would be
% good to know.

xsltproc (from libxslt) has a --profile switch which spits out number of
calls and execution time for templates. You can find a win32 port through
http:/xmlsoft.org.

--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #3
On Sun, 08 Feb 2004 23:44:45 +0000, Andy Dingley
<di*****@codesmiths.com> wrote:
Any advice on benchmarking tools / techniques ?


Thanks for all the advice (email too). I'll probably re-post a few
specific issues, as I get to them.

Today I dived into "the nasty bit" for the first serious
investigation. It is far, far, more horrible than I ever dreamed was
even possible in XSLT. I don't think this is implementable in
InterCal !

Self-referential code is always fun. This bit renders images (so it's
buried deep and frequently called), and supplies a placeholder image
if the image descriptor is empty or the wrong size.

Placeholders are picked from a list of candidates, picked from a list
of candidate stylesheets. document() is used to load the stylesheets,
using a URL that's built dynamically on each call..... I look forward
to benchmarking _that_ !

Curiously the candidates are placed in the stylesheets (which have
probably been loaded already anyway) as the values of <xsl:variable>.
Yet we go through this insane indirection of
document($foo)/xsl:stylesheet/xsl:variable[@name='bar']
to load them !

Code usually drives me to coffee, or sometimes beer for the nastiest.
After this I opened a new bottle of Scotch !

--
Smert' spamionam
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Trevor Best | last post by:
Is there a ready made database for benchmarking a server's performance to see what tweaks external to SQL Server will have an effect? -- A)bort, R)etry, I)nfluence with large hammer.
6
by: ree32 | last post by:
I am a bit confused with capabilities of XML. I have an XML document with information on images(photos). Is there way to use XSL/XSLT to create a page that will display the images as gallery. ...
6
by: Christopher | last post by:
I am currently in the process of evaluating the performance hits of moving to the .NET platform for our application. I created a sample project that loads the transforms the same XML and XSLT in...
5
by: | last post by:
I was wondering if there would be any significant performance increases by loading Xslt Files into the Application Variables if there were a single or maybe multiple XSLT file(s) that would be used...
10
by: Michel Rouzic | last post by:
I need to determine how long does an addition take and how long does a multiplication takes. So far I've been trying to use the clock() function in my programs in order to find out how long it took...
1
by: Sergey Dubinets | last post by:
In effort to prioritize our goals we composed the list of random features each of them may add value to set of XSLT tools offered from Microsoft. 1. XSLTc (Compiler for XSLT...
9
by: starlight | last post by:
Hallo, there were some posts about this, but nothing I could find useful. I have a large XML file (80MB) and need certain information out of it. I though I could use XSLT with an fairy simple...
0
by: SpaceMarine | last post by:
hello, im having a discussion w/ one of my associates, and we're are trying to get a consensus on a possible performance scenario. we're working a/ 3-rd party component that produces PDFs using...
12
by: Stu | last post by:
Being a newbie with XSLT transformation code please excuse my neivte. In addition, I am not sure what I want to do can be done with xslt so I apologize up front for asking anything stupid I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.