Re: [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-09 01:41:19
|
Just a short report, for the record, of my experience with the profiler now built into XSLTForms. Short version: the profiler is very helpful; in this case three relatively simple changes produced a five-fold speedup in the form. Long version: Looking at the profile information for the form I was worrying about, which had gotten too slow when the document it was operating on got bigger, I found that the most expensive XPath expressions were those used for numbering the cells of the stack and for numbering the instructions in the code area. I hard-coded appropriate numbers into attributes in the machine description, and I added a set of actions for adding a numbering attribute to the instructions in a program, after loading it. I then replaced each XPath expression of the form count(preceding-sibling::cell) +1 or count(preceding-sibling::i) with a reference to @n. I also removed the support for editing the program code; I'll move it to a separate form which communicates with the main form by bouncing the XML representation of the document off of a routine on the server. The first two changes (prenumbering the stack cells and autonumbering the instructions in the program) reduced the XForms Cumulative Refresh Time after loading a program and stepping through 50 cycles of machine time (i.e. clicking Step 50 times) from 94.6 seconds to 42.3 seconds, making the program about twice as fast. The third change (removing the editing functionality to a separate form) took it down to 17.7 seconds, another twofold speedup, for a five-fold speedup overall. Those who are curious can compare the timings and the subjective experience of the form by looking at the old and new versions of the form at http://blackmesatech.com/2011/12/pl0/v01.xhtml (old) http://blackmesatech.com/2011/12/pl0/index.xhtml (new) (Hmm. I notice that the XSLTforms I'm using on that server is an old version that doesn't yet have the profiler. I'll have to update soon.) -- **************************************************************** * C. M. Sperberg-McQueen, Black Mesa Technologies LLC * http://www.blackmesatech.com * http://cmsmcq.com/mib * http://balisage.net **************************************************************** |