[Xsltforms-support] getting your feet wet with the profiler (was Re: optimization question)
Brought to you by:
alain-couthures
From: C. M. Sperberg-M. <cm...@bl...> - 2011-12-08 17:59:29
|
In case there are others who have occasional performance problems and aren't sure how to deal with them ... (This may be old hat to most readers of this list. But I was taught at an impressionable age that the first rule of optimization is "don't do it" and the second rule is "don't do it yet" -- I see that Wikipedia attributes this to Michael A. Jackson -- so I have never bothered to worry much about speed in my XForms work, since I have never had any particular problems with it. If you already know how to use the xsltforms profiler, you can stop reading now. If you don't know, and worry that it might be difficult to set up, keep going.) On Dec 7, 2011, at 7:42 PM, C. M. Sperberg-McQueen wrote: > ... > > Are there good ways to see where the time is going? Are there > obvious ways to make it faster? > > Thanks for any tips, suggestions, or thought-provoking questions. For the record: shortly after sending this, I remembered that Alain had recently responded to Jakob Fix saying > It could be interesting to test with recent SVN build (but before rev. > 512 if you need exsltforms), considering that the included profiler > tells you in details the different times that can be measured. Ah, I said. But how do I turn profiling on? Is this going to be a lot of work for me? For the benefit of others hesitant in the same way, let me say here: it's easier than you fear, and it was probably a lot of work for Alain, but it's not a lot of work for you. This is what I did: (1) point the form at .../trunk/build/xsltforms.xsl instead of at its earlier target (2) turn debugging on using <?xsltforms-options debug="yes"?> (3) reload the form and load one of the sample datasets (4) click the 'Profile' button in the 'Debug Mode' area at the top of the form (5) read the report, which shows a great deal of useful information (6) click the Step button and return to step 4, or else do nothing and return to step 3, or else quit. The information about which XPath expressions are taking the most time is particularly interesting and useful, as it shows that the XPath expressions I was most worried about are not in fact the ones taking the most time. If I had spent a lot of time reformulating the XPath expressions I was worried about, I would have wasted all that time in a perfect illustration of pointless optimization of things that don't make a difference. Long ago a wise man told me 'Never try to optimize until after you measure to find out where the time is going'. The profiler in xsltforms helps a LOT with that. Bravo, Alain!! -- **************************************************************** * C. M. Sperberg-McQueen, Black Mesa Technologies LLC * http://www.blackmesatech.com * http://cmsmcq.com/mib * http://balisage.net **************************************************************** |