Wow, thats good to know, thanks! A lot of my evaluate statements are done
within a loop. Sounds like trouble right?
#evaluate("attributes.#listgetat(x,5)#")#
Brook
At 10:26 AM 31/07/02 -0700, you wrote:
>On Wednesday, July 31, 2002, at 10:23 , Brook Davies wrote:
> > How does this work? Instead of using evaluate? Is this faster? I have a
> > lot
> > of evaluate statements in my code and Ramond Chan's words haunt me ;)
>
>Show us some of your code that uses evaluate() and we'll see if we can
>show you a simpler and/or faster way to write it.
>
> > And, another question. If I have a big long fat list, is it faster to
> > convert it to an array and loop over the array than it is to just loop
> > over
> > the list or use the listgetat() command?
>
>I would *expect* it to be faster to convert the list once and then loop
>over it. Hmm, I feel a performance test coming on...
>
>Big difference in speed!!! 20x
>
>1000 iterations:
>listGetAt took 13589 ms
>array took 724 ms
>
>Here's the test:
><cfparam name="URL.loop" type="numeric" default="1"/>
><cfscript>
> loop = URL.loop;
> listOfStuff = "000";
> for ( i = 1; i le 100; i = i + 1 )
> listOfStuff = listOfStuff & "," & i & i & i;
> s1 = getTickCount();
>for ( q = 1; q le loop; q = q + 1 ) {
> len = listLen(listOfStuff);
> for ( i = 1; i le len; i = i + 1 )
> x = listGetAt(listOfStuff,i);
>}
> e1 = getTickCount();
> s2 = getTickCount();
>for ( q = 1; q le loop; q = q + 1 ) {
> arrayOfStuff = listToArray(listOfStuff);
> len = arrayLen(arrayOfStuff);
> for ( i = 1; i le len; i = i + 1 )
> x = arrayOfStuff[i];
>}
> e2 = getTickCount();
></cfscript>
><cfoutput>
>#loop# iterations:<br/>
>listGetAt took #e1 - s1# ms<br/>
>array took #e2 - s2# ms<br/>
></cfoutput>
>
>Sean A Corfield -- http://www.corfield.org/blog/
>
>"If you're not annoying somebody, you're not really alive."
>-- Margaret Atwood
>
>
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists