Well this hilarious!

The test proved me wrong!

It takes longer when I do specify the scope for the query, see test below.
I would have betted money on the fact it would be quicker, glad I didn't! 
Why would that be though?

<cfscript>
qTest = queryNew("id, test");
for ( i = 0; variables.i LTE 2000; i = variables.i + 1 )
{
        queryAddRow(variables.qTest);
        querySetCell(variables.qTest, "id", variables.i);
        querySetCell(variables.qTest, "test", "Test " & variables.i);
}
</cfscript>

<cfoutput>

<cfset tickCount = getTickCount()>
<p>
<cfloop query="qTest">
#id# #test#<br/>
</cfloop></p>
<p>#getTickCount() - variables.tickCount#</p>

<cfset tickCount = getTickCount()>
<p>
<cfloop query="qTest">
#qTest.id# #qTest.test#<br/>
</cfloop></p>
<p>#getTickCount() - variables.tickCount#</p>

<cfset tickCount = getTickCount()>
<p>
<cfloop query="qTest">
#variables.qTest.id# #variables.qTest.test#<br/>
</cfloop></p>
<p>#getTickCount() - variables.tickCount#</p>

</cfoutput>

-----Original Message-----
From: Sean A Corfield [mailto:[EMAIL PROTECTED]
Sent: Thursday, 18 December 2003 12:14 PM
To: CFAussie Mailing List
Subject: [cfaussie] Re: Just wondering... ( as usual)


On Dec 16, 2003, at 8:22 PM, Taco Fleur wrote:
> I was wondering whether #variables.qSearchResult.recordCount# would be 
> quicker than #qSearchResult.recordCount# ?

Why don't you write a test case and try it out?

I'd bet that #variables.qSearchResult.recordCount# will be faster 
(because CF doesn't have to perform a runtime scope lookup).

Bear in mind that straight line speed does not always make for the 
fastest system under load (which you can only find out using multiuser 
load testing!).

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to