One comment I just want to throw in here; Regardless of any perceived performance issue with this code, its actually very bad programming practice to calculate the length of an array in the head of the loop that is processing that array.
There are times that it can be very powerful, but generally speaking, unless it's an exceptionally simple piece code, its more likely to lead to trouble. Just a thought for you. Stephen On 2 Sep 2010 17:04, "Alan Holden" <[email protected]> wrote: > Thanks for your time and thoughts. > > First of all, I agree that the performance difference would be arguably > minor, even when "calculated for millions and millions of hits per day" > (paraphrased from the requirement in question). My purpose here was to > discredit or validate the assumption, regardless of it's actual impact. > > Actually, I seem to recall where array or list looping routines will > actually use integer copies within the condition, not the real length > property. If the target were to gain or loose an element during the loop > (oh yeah, that's a GREAT idea I had... once) the original condition > would not change. But I can't recall if I saw that in CF, OpenBD or JSP. > > Thanks again. > Al > > On 9/2/2010 1:05 AM, Alan Williamson wrote: (snip) >> >> But even an ArrayLen() is just a call to an internal integer. >> CFML in this respect is no different from every other language. >> >> Al Holden wrote: (snip) >>> >>> Please discuss. Is the length property computed on the fly each time >>> it's called? Or does the array object actually store the length >>> property as a mutable integer that's adjusted only as needed? >> > > -- > Open BlueDragon Public Mailing List > http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon > official manual: http://www.openbluedragon.org/manual/ > Ready2Run CFML http://www.openbluedragon.org/openbdjam/ > > mailing list - http://groups.google.com/group/openbd?hl=en -- Open BlueDragon Public Mailing List http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon official manual: http://www.openbluedragon.org/manual/ Ready2Run CFML http://www.openbluedragon.org/openbdjam/ mailing list - http://groups.google.com/group/openbd?hl=en
