any second gained is a second better for user experience.
ive never touched cfscript, AT ALL apart from cflib udf's
ive heard from very high higher uppers in the world of
cf that cfscript just really wasnt that much better once CFMX
happened and i took that and ran.
-- tony
Better than a thousand hollow words, is one word that brings peace.
-- siddhartha gautama
On Tue, Jul 1, 2008 at 9:28 PM, Larry Lyons <[EMAIL PROTECTED]> wrote:
> OK I got into a discussion at my new job about setting variables by the cfset
> tag or via a variable assignment using cfscript. The consensus has been that
> when setting large blocks of variables using cfscript is faster than cfset.
> The reason that tags are slower is that when the template JITs, it adds extra
> libraries into the class. So when you use cfscript, your code needs fewer
> cftag libraries mentioned as Java import namespaces because your code is
> closer to the native Java and requires less overhead. Also, the tag named
> import also contains functionality you may not be using. Therefore, you have
> thinner JITs and faster code.Or so I thought. Here's some code I wrote to
> test this:
>
> <cfset variables.iterations = 1000000/>
> <cfscript>
> start1 = getTickCount();
> result=0;
> for(i=0;i lte #variables.iterations#;i=i+1) {
> result=result+i;
> }
> end1 = getTickCount();
> </cfscript>
>
> <cfset start2 = getTickCount() />
> <cfset result2 = 0 />
> <cfloop from="1" to="#variables.iterations#" index="j">
> <cfset result2=result2+j />
> </cfloop>
> <cfset end2 = getTickCount() />
>
> <fieldset>
> <legend>CFSCRIPT</legend>
> <p><cfoutput>#result#</cfoutput><br /><br />
> <cfoutput>Execution Time: #end1 - start1#ms</cfoutput></p>
> </fieldset>
>
> <fieldset><legend>CFSET</legend>
> <p><cfoutput>#result2#</cfoutput><br /><br />
> <cfoutput>Execution Time: #end2 - start2#ms</cfoutput></p>
> </fieldset>
>
> The results:
>
> CFSCRIPT
> total: 500000500000
> Execution Time: 1472ms
>
> CFSET
> total: 500000500000
> Execution Time: 947ms
>
> So am I missing something here? This was on an XP box (dell opteron dual core
> with 2 gigs of ram) with service pack 2, running the dev edition of CFMX 7.02
> with cumulative hotfix 3 installed. I got similar results using Open
> BlueDragon on the Mac. Generally these results go against what's commonly
> thought. However given that there was only about a half second difference
> over a million iterations, is it really an important difference?
>
> larry
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j
Archive:
http://www.houseoffusion.com/groups/CF-Community/message.cfm/messageid:263219
Subscription: http://www.houseoffusion.com/groups/CF-Community/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5