[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 |