On this page:
Microsoft recently announced an XSLT profiler for Visual Studio 2008. (I have used it briefly and it seems quite good.)
PHP recently announced PHP 5.3 which will include an XSLT profiler that can be invoked from within code. Current versions of PHP and the Microsoft one can invoke an XSLT profiler through the command line or against static XML/XSL files only, so being able to call it from within code is quite useful.
The run time invocation is really useful because if you are passing parameters into the XSLT or are generating the XML through DOM programmatically it is easier to profile. Otherwise, you need to capture the XML generated and save it, then invoke a profiler separately from the command line.
An example of calling it from within PHP is this (taken from a SitePoint article explaining the new features — see previous link):
$doc = new DOMDocument(); $xsl = new XSLTProcessor(); $doc->load('./lib/collection.xsl'); $xsl->importStyleSheet($doc); $doc->load('./lib/collection.xml'); $xsl->setProfiling("/tmp/xslt-profiling.txt"); echo $xsl->transformToXML($doc); echo '<h2>Profile report</h2>'; echo '<pre>' . file_get_contents( '/tmp/xslt-profiling.txt' ) . '</pre>';
Are there other profilers out there you recommend?
I have not used XSLT profilers extensively. Just once in a blue moon. Some of the XSLT performance tips I have written earlier seems to have served me well, thus far, but I think more regular use of these profilers will be important.
Have you used other profilers for XSLT? What are they like?
Have you used other profilers that you can invoke from your code, rather than from an IDE or command line?
Do you find that to be useful or in the end is it just as easy to capture the XML and run the profiler in the IDE (which usually has a more powerful GUI to splice and dice the profile data)?
What about XSLT code coverage?
Is anyone aware of any good XSLT code coverage tools?
The reason this is important is that as well as getting good performance, it is important to know if you are exercising all your XSLT code or not.
This would be particularly useful when integrated with unit-tested XSLTs (which I will be writing about shortly!).
“Stopwatch” by jamieriddell from flickr. See the original image at http://www.flickr.com/photos/jamieriddell/2183060366/.