Content deleted Content added
No edit summary |
Ubernostrum (talk | contribs) No edit summary |
||
Line 27:
--Kevin
== Non-compiler use ==
This sort of optimization is frequently seen in JavaScript, where iterating over an array or a list of DOM nodes can often be sped up by precalculating the length of the array or node list either outside the loop or (more commonly) in the initialization of the loop variables (e.g., <code>for(var i=0, max=someList.length; i < max; i++)</code> instead of <code>for(var i=0; i<someList.length; i++)</code>, avoiding the repetitive computation -- in some JavaScript implementations -- of <code>someList.length</code>). If anyone thinks this would be a useful addition to the article, I'll dig up some references and put it in. [[User:Ubernostrum|Ubernostrum]] 08:43, 5 July 2007 (UTC)
|