Thread: [Xsltforms-support] xsltforms Performance
Brought to you by:
alain-couthures
From: Christopher D. <cd...@vi...> - 2010-01-23 15:09:26
|
I have been using xsltforms to create some complicated interfaces. xsltforms performance appears to degrade significantly as the size of the instance data increases. It does not seem to be impacted as significantly by the number of input controls on the page. This means that paging the items in my repeat element has almost no performance impact. 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. What are the scalability limits of xsltforms? Do you have any suggestions on how to improve performance in my xforms document? Thanks |
From: COUTHURES A. <ala...@ag...> - 2010-01-23 16:16:03
|
Christopher, > > I have been using xsltforms to create some complicated interfaces. > xsltforms performance appears to degrade significantly as the size of > the instance data increases. It does not seem to be impacted as > significantly by the number of input controls on the page. This means > that paging the items in my repeat element has almost no performance > impact. > Can you send me a link or the XForms document itself with its data ? > > > > Profiling tools report at least 13 seconds in IE 8 (2.5 seconds in > FF/Chrome) > Yes, IE is still very slower... > > to "tab" from one field to the next, regardless of whether the data in > the field was changed. > It's a good situation to check with a javascript debugger (focus is lost,...). > > As you can expect, this is not acceptable for my users. > There are different possibilities of optimization in XSLTForms: less generated HTML elements, less Javascript instructions executed,... Because this has not been done yet, I hope that a minimal effort could improve it significantly. > > > > What are the scalability limits of xsltforms? > This is not yet determined but there are many parameters involved: complexity, instance size, number of bindings, ... > > Do you have any suggestions on how to improve performance in my > xforms document? > Use of // in XPath expressions is surely to avoid. -Alain |
From: Christopher D. <cd...@vi...> - 2010-01-26 16:13:08
|
I have found a partial workaround for the time being. I was able to significantly improve the performance in IE6/8 by reducing the number of elements and attributes in the instance data. The net effect was that my documents now load in about 4 seconds. This is not an ideal situation as the number of data elements in my repeat structures grow, I will be back where I started. Alain, were you able to get anything from the documents I sent you? Thanks From: COUTHURES Alain [mailto:ala...@ag...] Sent: Saturday, January 23, 2010 11:16 AM To: Christopher Dedels Cc: xsl...@li... Subject: Re: [Xsltforms-support] xsltforms Performance Christopher, I have been using xsltforms to create some complicated interfaces. xsltforms performance appears to degrade significantly as the size of the instance data increases. It does not seem to be impacted as significantly by the number of input controls on the page. This means that paging the items in my repeat element has almost no performance impact. Can you send me a link or the XForms document itself with its data ? Profiling tools report at least 13 seconds in IE 8 (2.5 seconds in FF/Chrome) Yes, IE is still very slower... to "tab" from one field to the next, regardless of whether the data in the field was changed. It's a good situation to check with a javascript debugger (focus is lost,...). As you can expect, this is not acceptable for my users. There are different possibilities of optimization in XSLTForms: less generated HTML elements, less Javascript instructions executed,... Because this has not been done yet, I hope that a minimal effort could improve it significantly. What are the scalability limits of xsltforms? This is not yet determined but there are many parameters involved: complexity, instance size, number of bindings, ... Do you have any suggestions on how to improve performance in my xforms document? Use of // in XPath expressions is surely to avoid. -Alain |
From: Christopher D. <cd...@vi...> - 2010-02-03 14:38:13
|
Alain, I have a follow-up and possibly a partial solution to this issue. However, I would like your feedback. My largest issue is the number of seconds it takes a user to "tab" from one field to the next in my form. As you probably saw, my form has several unique characteristics: . very large instance data . several hundred inputs . nested repeats (3 levels deep) After doing some profiling in IE, I noticed that the xmlValue and ExprContext functions are the biggest offenders in both number of calls and execution time. After investigating this a bit further, I noticed that the xforms-recalculate event was being called twice--once from XFControl.prototype.valueChanged and again from xforms.closeAction. It seems to me that XFControl.prototype.valueChanged does all the leg work so that xforms.closeAction will recalculate and revalidate the instance. By removing the line: XMLEvents.dispatch(model, "xforms-recalculate"); from XFControl.prototype.valueChanged, I was able to almost halve the time it takes a user to "tab" from one field to the next. Preliminary testing indicates that there are no negative side effects. Is there any reason why this cannot be a permanent (albeit partial) fix for this issue? Regards, Chris From: COUTHURES Alain [mailto:ala...@ag...] Sent: Saturday, January 23, 2010 11:16 AM To: Christopher Dedels Cc: xsl...@li... Subject: Re: [Xsltforms-support] xsltforms Performance Christopher, I have been using xsltforms to create some complicated interfaces. xsltforms performance appears to degrade significantly as the size of the instance data increases. It does not seem to be impacted as significantly by the number of input controls on the page. This means that paging the items in my repeat element has almost no performance impact. Can you send me a link or the XForms document itself with its data ? Profiling tools report at least 13 seconds in IE 8 (2.5 seconds in FF/Chrome) Yes, IE is still very slower... to "tab" from one field to the next, regardless of whether the data in the field was changed. It's a good situation to check with a javascript debugger (focus is lost,...). As you can expect, this is not acceptable for my users. There are different possibilities of optimization in XSLTForms: less generated HTML elements, less Javascript instructions executed,... Because this has not been done yet, I hope that a minimal effort could improve it significantly. What are the scalability limits of xsltforms? This is not yet determined but there are many parameters involved: complexity, instance size, number of bindings, ... Do you have any suggestions on how to improve performance in my xforms document? Use of // in XPath expressions is surely to avoid. -Alain |
From: COUTHURES A. <ala...@ag...> - 2010-02-07 16:22:38
|
Christopher, > After investigating this a bit further, I noticed that the xforms-recalculate event was being called twice--once from XFControl.prototype.valueChanged and again from xforms.closeAction. > I have checked AJAXForms sources and it appears it was already like that. It seems impossible to contact AJAXForms creator so I won't be able to say why there is this double call. > It seems to me that XFControl.prototype.valueChanged does all the leg work so that xforms.closeAction will recalculate and revalidate the instance. Yes, xforms.closeChanges is called to perform the necessary event dispatches when everything is done and I agree that this should be the only place for xforms-recalculate to be dispatched. > By removing the line: > > XMLEvents.dispatch(model, "xforms-recalculate"); > > from XFControl.prototype.valueChanged, The next line: xforms.refresh(); should also be removed for the same reason or it would disturb xforms.closeChanges. > I was able to almost halve the time it takes a user to "tab" from one field to the next. Very interesting indeed because IE is so slow... > Preliminary testing indicates that there are no negative side effects. > > Is there any reason why this cannot be a permanent (albeit partial) fix for this issue? > The SVN version is now integrating your suggestion. My own tests are passed but more are required to be sure... Thanks! -Alain |
From: Tambet M. <tam...@gm...> - 2010-01-27 08:30:28
|
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 |
From: Klotz, L. <Lei...@xe...> - 2010-01-27 22:38:54
|
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 |
From: Tambet M. <tam...@gm...> - 2010-01-28 07:55:10
|
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 |
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 |
From: Javier D. <jd...@ge...> - 2010-03-08 15:47:57
|
125c125 < for (var i = 0 , len = scripts.length; i < len; i++) { --- > for (var i = 0; i < scripts.length; i++) { 415,416c415,416 < for (var i = 0 , len = this.depth; i < len; i++) { < for (var j = 0 , len1 = this.selectstack[i].length; j < len1 ; j++) { --- > for (var i = 0; i < this.depth; i++) { > for (var j = 0; j < this.selectstack[i].length; j++) { 435c435 < for (var i = 0 , len = selects.length; i < len; i++) { --- > for (var i = 0; i < selects.length; i++) { 451c451 < for (var j = 0, len1 = dis.length; j < len1; j++) { --- > for (var j = 0; j < dis.length; j++) { 815c815 < for (var i = 0 , len = arguments.length - 2; i < len; i++) { --- > for (var i = 0; i < arguments.length - 2; i++) { 821c821 < for (var j = 0 , len1 = object.length; j < len1; j++) { --- > for (var j = 0; j < object.length; j++) { 872c872 < for (var i = 0 , len = array.length; i < len; i++) { --- > for (var i = 0; i < array.length; i++) { 978c978 < for (var i = 0, len = source.length; i < len; i++) { --- > for (var i = 0; i < source.length; i++) { 1101c1101 < for (var i = 0, len = changes.length; i < len; i++) { --- > for (var i = 0; i < changes.length; i++) { 1157c1157 < for (var i = 0, len = this.models.length; i < len; i++) { --- > for (var i = 0; i < this.models.length; i++) { 1202c1202 < for (var i = 0, len = childs.length; i < len && this.building; i++) { --- > for (var i = 0; i < childs.length && this.building; i++) { 1246c1246 < for (var i = 0, len = childs.length; i < len; i++) { --- > for (var i = 0; i < childs.length; i++) { 1328c1328 < for (var i = 0, len = ids.length; i < len; i++) { --- > for (var i = 0; i < ids.length; i++) { 1429c1429 < for (var i = 0, len = schemas.length; i < len; i++) { --- > for (var i = 0; i < schemas.length; i++) { 1693c1693 < for (var i = 0, len = atts.length; i < len; i++) { --- > for (var i = 0; i < atts.length; i++) { 1698c1698 < for (var j = 0, len1 = node.childNodes.length; j < len1; j++) { --- > for (var j = 0; j < node.childNodes.length; j++) { 1715c1715 < for (len = nodes.length; i < len; i++) { --- > for (; i < nodes.length; i++) { 1756c1756 < for (var i = 0, len = json.length; i < len ; i++) { --- > for (var i = 0; i < json.length; i++) { 1826c1826 < for (var i = 0, len = this.nodes.length; i < len; i++) { --- > for (var i = 0; i < this.nodes.length; i++) { 1843c1843 < for (var j = 0, len1 = el.childNodes.length; j < len1; j++) { --- > for (var j = 0; j < el.childNodes.length; j++) { 1856c1856 < for (var i = 0, len = this.nodes.length; i < len; i++) { --- > for (var i = 0; i < this.nodes.length; i++) { 1867c1867 < for (var j = 0, len1 = el.childNodes.length; j < len1; j++) { --- > for (var j = 0; j < el.childNodes.length; j++) { 1896c1896 < for (var i = 1, len = lines.length; i < len; i++) { --- > for (var i = 1; i < lines.length; i++) { 2133c2133 < for(var i = 0, len = node.childNodes.length; i < len; i++) { --- > for(var i = 0; i < node.childNodes.length; i++) { 2388c2388 < for(var i = 0, len = nodes.length; i < len; i++) { --- > for(var i = 0; i < nodes.length; i++) { 2475c2475 < for(var i = 0, len = originNodes.length; i < len; i += 1) { --- > for(var i = 0; i < originNodes.length; i += 1) { 2707c2705 < for (var i = ul != null? 1 : 0, len = childs.length; i < len; i++) { --- > for (var i = ul != null? 1 : 0; i < childs.length; i++) { 2838c2836 < for (var i = 0, len = childs.length; i < len; i++) { --- > for (var i = 0; i < childs.length; i++) { 2851c2849 < for (var j = ul.childNodes.length, len1 = childs.length; j > len1; j--) { --- > for (var j = ul.childNodes.length; j > childs.length; j--) { 2869c2867 < for (var i = 0, len = attrs.length; i < len; i++) { --- > for (var i = 0; i < attrs.length; i++) { 2957c2955 < for (var i = 0, len = deps.length; !build && i < len; i++) { --- > for (var i = 0; !build && i < deps.length; i++) { 2960c2958 < for (var j = 0, len1 = changes.length; !build && j < len1; j++) { --- > for (var j = 0; !build && j < changes.length; j++) { 2966c2964 < for (var k = 0, len2 = depsN.length; !build && k < len2; k++) { --- > for (var k = 0; !build && k < depsN.length; k++) { 2971c2969 < for (var n = 0, len3 = depsR.length; n < len3; n++) { --- > for (var n = 0; n < depsR.length; n++) { 3270c3268 < for (var i = 1, len = childs.length; i < len; i++) { --- > for (var i = 1; i < childs.length; i++) { 3537c3535 < for (var i = 0, len = value.length; i < len; i++) { --- > for (var i = 0; i < value.length; i++) { 3727c3725 < for (var j = 0, len = this.nodes.length; j < len || j == 0; j++) { --- > for (var j = 0; j < this.nodes.length || j == 0; j++) { 3812c3810 < for (var i=0, len = this.valueElement.childNodes.length; i<len; i++) { --- > for (var i=0; i<this.valueElement.childNodes.length; i++) { 3932c3930 < for (var i = 0, len = nodes.length; i < len; i++) { --- > for (var i = 0; i < nodes.length; i++) { 3952c3950 < for (var i = 0, len = nodes.length; i < len; i++) { --- > for (var i = 0; i < nodes.length; i++) { 3985c3983 < for (var j = n, len = r.childNodes.length; j < l && len > 1; j++) { --- > for (var j = n; j < l && r.childNodes.length > 1; j++) { 4012c4010 < for (var i = 0, len = childs.length; i < len; i++) { --- > for (var i = 0; i < childs.length; i++) { 4046c4044 < for (var i = 0, len = listeners.length; i < len; i++) { --- > for (var i = 0; i < listeners.length; i++) { 4077c4075 < for (var i = 0, len = childs.length; i < len; i++) { --- > for (var i = 0; i < childs.length; i++) { 4146c4144 < for (var i = 0, len = vals.length; well && i < len; i++) { --- > for (var i = 0; well && i < vals.length; i++) { 4150c4148 < for (var j = 0, len1 = list.length; !finded && j < len1; j++) { --- > for (var j = 0; !finded && j < list.length; j++) { 4173c4171 < for (var n = 0, len2 = list.length; n < len2; n++) { --- > for (var n = 0; n < list.length; n++) { 4179c4177 < for (var k = 0, len3 = list.length; k < len3; k++) { --- > for (var k = 0; k < list.length; k++) { 4198c4196 < for (var i = 0, len = list.length; i < len; i++) { --- > for (var i = 0; i < list.length; i++) { 4218c4216 < for (var i = 0, len = inputs.length; i < len; i++) { --- > for (var i = 0; i < inputs.length; i++) { 4237c4235 < for (var j = 0, len1 = inputs.length; j < len1; j++) { --- > for (var j = 0; j < inputs.length; j++) { 4283c4281 < for (var i = 0, len = old.length; i < len; i++) { --- > for (var i = 0; i < old.length; i++) { 4291c4289 < for (var j = 0, len1 = opts.length; j < len1; j++) { --- > for (var j = 0; j < opts.length; j++) { 4330c4328 < for (var i = 0, len = opts.length; i < len; i++) { --- > for (var i = 0; i < opts.length; i++) { 4871c4869 < for (var i = 0, len = this.patterns.length; i < len; i++) { --- > for (var i = 0; i < this.patterns.length; i++) { 4880c4878 < for (var j = 0, len1 = this.enumeration.length; j < len1; j++) { --- > for (var j = 0; j < this.enumeration.length; j++) { 4987c4985 < for (var i = 0, len = items.length; i < len; i++) { --- > for (var i = 0; i < items.length; i++) { 5013c5011 < for (var i = 0, len = items.length; i < len; i++) { --- > for (var i = 0; i < items.length; i++) { 5043c5041 < for (var i = 0, len = this.baseTypes.length; i < len; ++i) { --- > for (var i = 0; i < this.baseTypes.length; ++i) { 6290c6288 < for (var i = 0, len = this.childNodes.length; i < len; ++i) { --- > for (var i = 0; i < this.childNodes.length; ++i) { 6329c6327 < for (var i = 0, len = this.childNodes.length; i < len; ++i) { --- > for (var i = 0; i < this.childNodes.length; ++i) { 6377c6375 < for (var i = 0, len = this.childNodes.length; i < len; ++i) { --- > for (var i = 0; i < this.childNodes.length; ++i) { 6409c6407 < for (var i = 0, len = this.childNodes.length; i < len; ++i) { --- > for (var i = 0; i < this.childNodes.length; ++i) { 6442c6440 < for (var i = 0, len = this.attributes.length; !founded && i < len; i++) { --- > for (var i = 0; !founded && i < this.attributes.length; i++) { 6471c6469 < for (var i = 0, len = this.attributes.length; i < len; ++i) { --- > for (var i = 0; i < this.attributes.length; ++i) { 6488c6486 < for (var i = 0, len = this.attributes.length; i < len; i++) { --- > for (var i = 0; i < this.attributes.length; i++) { 6514c6512 < for (var i = 0, len = this.childNodes.length; i < len; i++) { --- > for (var i = 0; i < this.childNodes.length; i++) { 6518c6516 < for (var j = 0, len1 = this.attributes.length ; j < len1; j++) { --- > for (var j = 0; j < this.attributes.length; j++) { 6571c6569 < for (var a = 0, len = node.attributes.length; a < len; ++a) { --- > for (var a = 0; a < node.attributes.length; ++a) { 6575c6573 < for (var c = 0, len1 = node.childNodes.length; c < len1; ++c) { --- > for (var c = 0; c < node.childNodes.length; ++c) { 6713c6711 < for (var i = 1, len = x.length; i < len; i++) { --- > for (var i = 1; i < x.length; i++) { 6767c6765 < for (var j = 0, len1 = atts.length; j < len1; j++) { --- > for (var j = 0; j < atts.length; j++) { 6873c6871 < for (var j = 0, len = atts.length; j < len; j++) { --- > for (var j = 0; j < atts.length; j++) { 6881c6879 < for (var k = 0, len1 = childs.length; k < len1; k++) { --- > for (var k = 0; k < childs.length; k++) { 6914c6912 < for (var i = 0, len = atts.length; i < len; i++) { --- > for (var i = 0; i < atts.length; i++) { 6918c6916 < for (var j = 0, len1 = childs.length; j < len1; j++) { --- > for (var j = 0; j < childs.length; j++) { 6943c6941 < for (var i = 0, len = value.length; i < len; i++) { --- > for (var i = 0; i < value.length; i++) { 6987c6985 < for (var i = 0, len = node.childNodes.length; i < len ; ++i) { --- > for (var i = 0; i < node.childNodes.length; ++i) { 7017c7015 < for (var i = 0, len = this.exprs.length; i < len; i++) { --- > for (var i = 0; i < this.exprs.length; i++) { 7043c7041 < for (var i = 0, len = v1.length; i < len; i++) { --- > for (var i = 0; i < v1.length; i++) { 7048c7046 < for (var j = 0, len1 = v2.length; j < len1; j++) { --- > for (var j = 0; j <v2.length; j++) { 7103c7101 < for(position = 1, len = node.repeat.nodes.length; position <= len; position++) { --- > for(position = 1; position <= node.repeat.nodes.length; position++) { 7224c7222 < for (var i = 0, len = this.predicate.length; i < len; ++i) { --- > for (var i = 0; i < this.predicate.length; ++i) { 7228c7226 < for (var j = 0, len1 = nodes0.length; j < len1; ++j) { --- > for (var j = 0; j < nodes0.length; ++j) { 7254c7252 < for (var i = 1, len = arguments.length; i < len; i++) { --- > for (var i = 1; i < arguments.length; i++) { 7265c7263 < for (var i = 0, len = this.args.length; i < len; i++) { --- > for (var i = 0; i < this.args.length; i++) { 7280c7278 < for (var i = 1, len = arguments.length; i < len; i++) { --- > for (var i = 1; i < arguments.length; i++) { 7301c7299 < for (var i = 0, len = nodelist.length; i < len; ++i) { --- > for (var i = 0; i < nodelist.length; ++i) { 7449c7447 < for (var i = 0, len = nodes.length; i < len; i++) { --- > for (var i = 0; i < nodes.length; i++) { 7453c7451 < for (var j = 0, len1 = nodes0.length; j < len1; j++) { --- > for (var j = 0; j < nodes0.length; j++) { 7486c7484 < for (var i = 2, len = arguments.length; i < len; i++) { --- > for (var i = 2; i < arguments.length; i++) { 7560c7558 < for (var i = 0, len = this.predicates.length; i < len; i++) { --- > for (var i = 0; i < this.predicates.length; i++) { 7564c7562 < for (var j = 0, len1 = list.length; j < len1; j++) { --- > for (var j = 0; j < list.length; j++) { 7586c7584 < for (var i = 0, len = l.length; i < len; i++) { --- > for (var i = 0; i < l.length; i++) { 7623c7621 < for (var i2 = 0, len = nodes2.length; i2 < len; ++i2) { --- > for (var i2 = 0; i2 < nodes2.length; ++i2) { 7694c7692 < for (var i = 0, len = node.childNodes.length; i < len; ++i) { --- > for (var i = 0; i < node.childNodes.length; ++i) { 7714c7712 < for (var i = 1, len = parts.length; i < len; ++i) { --- > for (var i = 1; i < parts.length; ++i) { 7789c7787 < for (var i = 0, len = ns.length; i < len; i += 2) { --- > for (var i = 0; i < ns.length; i += 2) { 7840c7838 < for (var i = 2, len = arguments.length; i < len; i += 2) { --- > for (var i = 2; i < arguments.length; i += 2) { 7971c7969 < for (var i = 0, len = object.length; i < len; ++i) { --- > for (var i = 0; i < object.length; ++i) { 7974c7972 < for (i = 0, len1 = res.length; i < len1; i++) { --- > for (i = 0; i < res.length; i++) { 8050c8048 < for (var i = 0, len2 = arguments.length; i < len2; ++i) { --- > for (var i = 0; i < arguments.length; ++i) { 8165c8163 < for (var i = 0, len3 = string.length; i < len3; ++i) { --- > for (var i = 0; i < string.length; ++i) { 8263c8261 < for (var i = 0, len4 = nodeSet.length; i < len4; ++i) { --- > for (var i = 0; i < nodeSet.length; ++i) { 8387c8385 < for (var i = 1, len5 = nodeSet.length; i < len5; ++i) { --- > for (var i = 1; i < nodeSet.length; ++i) { 8445c8443 < for (var i = 0, len6 = nodeSet.length; i < len6; ++i) { --- > for (var i = 0; i < nodeSet.length; ++i) { 8641c8639 < for (var i = 0, len7 = nodeSet.length; valid && i < len7; i++) { --- > for (var i = 0; valid && i < nodeSet.length; i++) { 9054c9052 < for (var i = 0, len = node.attributes.length; i < len; i++) { --- > for (var i = 0; i < node.attributes.length; i++) { 9060c9058 < for (var i = 0, len1 = node.childNodes.length; i < len1; i++) { --- > for (var i = 0; i < node.childNodes.length; i++) { 9127c9125 < for (var i = 0, len = node.childNodes.length; i < len; ++i) { --- > for (var i = 0; i < node.childNodes.length; ++i) { 9147c9145 < for (var i = 1, len = parts.length; i < len; ++i) { --- > for (var i = 1; i < parts.length; ++i) { |
From: Klotz, L. <Lei...@xe...> - 2010-03-08 19:52:05
|
My test was for significantly fewer than 200 checkboxes, which is probably why I didn't see the difference in clock time. ________________________________ From: Javier Díaz [mailto:jd...@ge...] Sent: Monday, March 08, 2010 7:48 AM To: Tambet Matiisen Cc: Klotz, Leigh; xsl...@li... Subject: Re: [Xsltforms-support] xsltforms Performance Hello, We have modified all the for's acceding to the length property of an array as described in the following page: http://www.erichynds.com/javascript/javascript-loop-performance-caching-the-length-property-of-an-array/ Attached I send you all the changes we have done (although the line numbers may vary from official version, we have change some lines). With these changes, xsltforms works better when having lots of instance data. In our worst case, we had a page that in explorer didn't managed to load (a dialog to abort the script appeared because it lasted too long), while with the modification now it loads ok (unfortunately in continues to be a bit slow). I hope it may be useful for anybody. Best Regards, Javier Tambet Matiisen escribió: 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 ________________________________ ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ________________________________ _______________________________________________ Xsltforms-support mailing list Xsl...@li... https://lists.sourceforge.net/lists/listinfo/xsltforms-support |
From: COUTHURES A. <ala...@ag...> - 2010-03-10 21:01:00
|
Javier, > We have modified all the for's acceding to the length property of an > array as described in the following page: > > http://www.erichynds.com/javascript/javascript-loop-performance-caching-the-length-property-of-an-array/ > > Attached I send you all the changes we have done (although the line > numbers may vary from official version, we have change some lines). Thank you very much for theses changes. I have checked them and some of them (few) appeared dangerous so I haven't integrated and committed all of them. I have tested with various tests and it was OK but regressions seem possible. If so, Javascript debugging shouldn't be difficult, anyway. It's always a good news to reduce IE execution time! -Alain |