Re: [Xsltforms-support] xsltforms Performance
Brought to you by:
alain-couthures
From: Klotz, L. <Lei...@xe...> - 2010-01-28 17:32:03
|
It might be worth investigating an alternate approach to this kind of performance enhancenement. For example, Google has an automated tool called Closure (bad name in my opinion): http://code.google.com/closure/ Using this tool means making some declarations about what names are global, though, and I think it would take some familiarity with XSLTForms to do that. By the way, XSLTForms doesn't "play nice" with some other JavaScript libraries because of its use of generic terms for globals ("Calendar", "Event", etc.) Maybe developing the config for Closure would help clarify that issue at the same time. Leigh. ________________________________ From: Tambet Matiisen [mailto:tam...@gm...] Sent: Wednesday, January 27, 2010 11:55 PM To: Klotz, Leigh Cc: xsl...@li... Subject: Re: [Xsltforms-support] xsltforms Performance I just did a few tests with my case. function selectAll(form, regexp, checked) { var elements = form.elements; var elements_length = elements.length; for(var i = 0; i < elements_length; i++) { var element = elements[i]; if (element.type == 'checkbox' && element.name.search(regexp) != -1) { element.checked = checked; } } } I had a form with 200 checkboxes. for(var i = 0; i < elements_length; i++) - took ~1s to check all for(var i = 0; i < elements.length; i++) - took ~2s to check all for(var i = 0; i < form.elements.length; i++) - took ~3s to check all It seems that accessing properties (maybe only form.elements?) is slow in IE(8). All cases worked almost instantaneously in FF(3.5). Tambet Klotz, Leigh wrote: I tried this just now; it was tedious but doable. I didn't bother for strings. Some loops affect the list length and need to be left alone. I didn't get it 100% right and get the occasional JS error; care must be taken! I tried a sample application and didn't see a measureable clock-time performance improvement in IE8. There are some areas where performance is poor compared to other FF3.6 (four seconds vs instantaneous) but this didn't fix it I'm willing to believe that this fixes problems I just didn't happen encounter, but it doesn't fix one I did encounter. Leigh. ________________________________ From: Tambet Matiisen [mailto:tam...@gm...] Sent: Wednesday, January 27, 2010 12:30 AM To: xsl...@li... Subject: Re: [Xsltforms-support] xsltforms Performance Christopher Dedels wrote: Profiling tools report at least 13 seconds in IE 8 (2.5 seconds in FF/Chrome) to "tab" from one field to the next, regardless of whether the data in the field was changed. As you can expect, this is not acceptable for my users. I've noticed, that IE calculates .length property of arrays by counting all array elements. This makes such cycles especially slow: for (var i = 0; i < frm.elements.length; i++) This can be easily fixed by assigning length to a variable: var elements_length = frm.elements.length; for (var i = 0; i < elements_length; i++) You could search XSLTForms javascript code for ".length" and try if this fix makes it better. Tambet |