I've recently learned of a programming requirement, based on the "fact" that the ColdFusion engine must actually traverse an array - each time our code requests it's length.

The requirement was that the length of arrays be determined once at the start (of a method, let's say) and set to a variable instead of calling arrayLen() over & over again. This would result in less processor usage.

Picture a x=1; x<array.length; x++ loop. Each time one looped through the array, CF allegedly had to count the array - with each iteration of the loop - in which x<array.length was in the looping condition.

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?

Thanks for your wisdom.

Al

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

Reply via email to