Re: [xsl] Managing debug logging in complex transforms: what do people do?

Subject: Re: [xsl] Managing debug logging in complex transforms: what do people do?
From: Liam R E Quin <liam@xxxxxx>
Date: Wed, 26 Mar 2014 14:56:08 -0400
On Mon, 2014-03-24 at 18:02 -0400, Graydon wrote:
[...]
> Single digit integer minutes, quite often, outside debug mode.

I remember a client with a transformation that was taking I think 20
minutes on a relatively small file; in the end I preprocessed the style
sheet to add a trace message at the start of each template, and ran that
through a simple program (I might'v written a Perl script to do it) that
timestamped each line of the trace.

I got it down to running in a few seconds by finding a couple of places
where the stylesheet was needlessly looking at every element in the
document instead of the immediately preceding element, and then, inside
that, looking at every element in the document to see if it was the
following element, instead of asking for the following element, so
O(n^3)...

Debugging and optimizing is rarely that lucky, but the approach is still
useful if you have slow transformations, because once it only takes a
few seconds to run you'll feel much better about fixing a few bugs.

On the other hand I don't recommend optimizing something that doesn't
yet work, as the more work you put into it, the less you'll be willing
to rewrite altogether when you find parts that are wrong :-) and it's a
waste of your time, of course.

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

Current Thread