Thread: [Xsltforms-support] Performance Tips
Brought to you by:
alain-couthures
From: Gordon R. <gor...@co...> - 2011-11-14 10:25:48
|
Hi I was wondering if anyone has any tips for getting the best performance out of my xsltforms implementation. I have an xform that runs reasonably well on FF, Chrome and Safari, but which struggles on IE8. Whilst the difference in timings can in some part be accredited to IE's poor javascript engine I'm not satisfied that this is the whole reason. The xform I've created has a single model and within that model there are 99 bindings, it seems to be that there is a direct correlation between the number of bindings and the performance of xsltforms. I want all of my data to be constructed and submitted at one point in time, so afaik that rules out splitting things into a separate model, although I would be interested to know if I've missed a trick somewhere. Profiling of xsltforms.js doesn't point to any single method taking a long time to execute, rather it's the accumulation of the processing that takes time. Some examples: XFControl.prototype.valueChanged - each time a value is changed on the form then the whole model is rebuilt. This means that in the case of my xform there is a loop of 99 calls to XFBind.prototype.recalculate. For any calculated bindings we then see a huge amount of calls around a number of evaluate methods e.g. in my xform for 5 calculated bindings there are 460 calls to LocationExpr.prototype.xPathStep. If I happen to write some custom javascript to set a few values on my form then the model is rebuilt each and every time. The method I use for setting a value is $(selector).get(0).xfElement.valueChanged(value); perhaps there is a more efficient way? When I xf:insert on a repeat I see the model being rebuilt once, but the recalculation happens twice (which obviously triggers a revalidation and a refresh both times). Why go through the recalculation cycle more than once? With a large model this has obvious impact. Any tips from those using xsltforms in anger would be welcome. Thanks, Gordon Gordon Rogers Senior Developer Corelogic Limited www.corelogic.co.uk <http://www.corelogic.co.uk/> Tel: 0131 550 0447 Email gor...@co... <mailto:gor...@co...> This document should only be read by those persons to whom it is intended, and its contents are private and confidential. If you receive this email message in error, notify the sender immediately and do not disclose, copy or distribute this message, or open any attachments |
From: Alain C. <ala...@ag...> - 2011-11-14 20:11:16
|
Hi Gordon, Since rev. 512 in the SF SVN repository, the MIPs evaluation is performed according to nodes dependencies which means that a minimal number of reevaluations is effectively run. You can also use the Profiler to locate which XPath expressions are requiring the most of the evaluation time. Please avoid using // and use id() function as much as you can. For Javascript own stuff, I added a js-eval() function to be called in a setvalue action for example. Thank you for your feedbacks! -Alain Le 14/11/2011 11:25, Gordon Rogers a écrit : > > Hi > > I was wondering if anyone has any tips for getting the best > performance out of my xsltforms implementation. I have an xform that > runs reasonably well on FF, Chrome and Safari, but which struggles on > IE8. Whilst the difference in timings can in some part be accredited > to IE's poor javascript engine I'm not satisfied that this is the > whole reason. > > The xform I've created has a single model and within that model there > are 99 bindings, it seems to be that there is a direct correlation > between the number of bindings and the performance of xsltforms. I > want all of my data to be constructed and submitted at one point in > time, so afaik that rules out splitting things into a separate model, > although I would be interested to know if I've missed a trick somewhere. > > Profiling of xsltforms.js doesn't point to any single method taking a > long time to execute, rather it's the accumulation of the processing > that takes time. Some examples: > > XFControl.prototype.valueChanged -- each time a value is changed on > the form then the whole model is rebuilt. This means that in the case > of my xform there is a loop of 99 calls to > XFBind.prototype.recalculate. For any calculated bindings we then see > a huge amount of calls around a number of evaluate methods e.g. in my > xform for 5 calculated bindings there are 460 calls to > LocationExpr.prototype.xPathStep. If I happen to write some custom > javascript to set a few values on my form then the model is rebuilt > each and every time. The method I use for setting a value is > $(selector).get(0).xfElement.valueChanged(value); perhaps there is a > more efficient way? > > When I xf:insert on a repeat I see the model being rebuilt once, but > the recalculation happens twice (which obviously triggers a > revalidation and a refresh both times). Why go through the > recalculation cycle more than once? With a large model this has > obvious impact. > > Any tips from those using xsltforms in anger would be welcome. > > Thanks, > > Gordon > > *Gordon Rogers* > > Senior Developer > > Corelogic Limited > > www.corelogic.co.uk <http://www.corelogic.co.uk/> > > Tel: 0131 550 0447 > > Email _go...@co... > <mailto:gor...@co...>_ > > This document should only be read by those persons to whom it is > intended, and its contents are private and confidential. If you > receive this email message in error, notify the sender immediately and > do not disclose, copy or distribute this message, or open any attachments > > > > ------------------------------------------------------------------------------ > RSA(R) Conference 2012 > Save $700 by Nov 18 > Register now > http://p.sf.net/sfu/rsa-sfdev2dev1 > > > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support |
From: Gordon R. <gor...@co...> - 2011-11-15 09:13:18
|
Hi Alain Thanks for the prompt response. We'll upgrade our version of xsltforms and give it a try. The performance tips also sound useful and we'll change our xforms accordingly. Thanks, Gordon From: Alain Couthures [mailto:ala...@ag...] Sent: 14 November 2011 19:58 To: Gordon Rogers Cc: xsl...@li... Subject: Re: [Xsltforms-support] Performance Tips Hi Gordon, Since rev. 512 in the SF SVN repository, the MIPs evaluation is performed according to nodes dependencies which means that a minimal number of reevaluations is effectively run. You can also use the Profiler to locate which XPath expressions are requiring the most of the evaluation time. Please avoid using // and use id() function as much as you can. For Javascript own stuff, I added a js-eval() function to be called in a setvalue action for example. Thank you for your feedbacks! -Alain Le 14/11/2011 11:25, Gordon Rogers a écrit : Hi I was wondering if anyone has any tips for getting the best performance out of my xsltforms implementation. I have an xform that runs reasonably well on FF, Chrome and Safari, but which struggles on IE8. Whilst the difference in timings can in some part be accredited to IE's poor javascript engine I'm not satisfied that this is the whole reason. The xform I've created has a single model and within that model there are 99 bindings, it seems to be that there is a direct correlation between the number of bindings and the performance of xsltforms. I want all of my data to be constructed and submitted at one point in time, so afaik that rules out splitting things into a separate model, although I would be interested to know if I've missed a trick somewhere. Profiling of xsltforms.js doesn't point to any single method taking a long time to execute, rather it's the accumulation of the processing that takes time. Some examples: XFControl.prototype.valueChanged - each time a value is changed on the form then the whole model is rebuilt. This means that in the case of my xform there is a loop of 99 calls to XFBind.prototype.recalculate. For any calculated bindings we then see a huge amount of calls around a number of evaluate methods e.g. in my xform for 5 calculated bindings there are 460 calls to LocationExpr.prototype.xPathStep. If I happen to write some custom javascript to set a few values on my form then the model is rebuilt each and every time. The method I use for setting a value is $(selector).get(0).xfElement.valueChanged(value); perhaps there is a more efficient way? When I xf:insert on a repeat I see the model being rebuilt once, but the recalculation happens twice (which obviously triggers a revalidation and a refresh both times). Why go through the recalculation cycle more than once? With a large model this has obvious impact. Any tips from those using xsltforms in anger would be welcome. Thanks, Gordon Gordon Rogers Senior Developer Corelogic Limited www.corelogic.co.uk <http://www.corelogic.co.uk/> Tel: 0131 550 0447 Email gor...@co... This document should only be read by those persons to whom it is intended, and its contents are private and confidential. If you receive this email message in error, notify the sender immediately and do not disclose, copy or distribute this message, or open any attachments ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ Xsltforms-support mailing list Xsl...@li... https://lists.sourceforge.net/lists/listinfo/xsltforms-support |