Joshua,
I agree with Michael on his assessments of switch/case run time performance.
I have tested this a great deal, as I am featuring a detailed account of
performance inconsistencies in my book. If you would like to contact me off
list regarding specific percent time savings I can provide you with solid
numbers and what kind of data I am using to make my calculations. I too am
biased in favor of cfscript but it is not right for use in every situation.
Tag based switch/case is very optimized.
- Chris
<!----------------------------------------------------------->
Christopher Cortes |Coming Q3 2001:
Consultant |
Stonebridge Technologies, Inc. | �Optimizing ColdFusion�
Putting Technology To Work | By
Visit us at www.sbti.com | Christopher Cortes
Ofc: 713.985.6244 cel: 281.235.6100 | www.osborne.com
<-----------------------------------------------------------!>
-----Original Message-----
From: Michael Dinowitz [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 30, 2001 11:16 AM
To: CF-Talk
Subject: Re: Benefits of <CFSWITCH> vs. <CFSCRIPT> with SWITCH
******************************* Team Allaire *******************************
> 1) It is possible to execute a block of code for more than one value.
Very cute hack. Mind if I steal it for my docs on CFSCRIPT?
> <cfscript>
> switch ( foo ) {
> case 1 :
> case 2 : {
> // code
> break;
>
> 2) What is the basis of the statement that says <cfswitch> / <cfcase> is
> twice as fast switch / case? Is the test code equivalent? Has anyone
> talked to one of Allaire's programmers about their implementation of
> this code? Are you already in a cfscript statement? Or are you starting
> a new cfscript block?
I tried each case.
1. a CFLOOP over a CFSWITCH
2. A CFLOOP over a CFSCRIPT switch
3. A CFSCRIPT for loop over a switch
I've redone my tests and have better numbers. In the CFSWITCH case we have a
speed of 80ms for CFSWITCH statements that have values or numbers or
letters. In the CFSCRIPT switch statement, a time of 140 ms was achieved for
cases where there were only numeric values. When letter values were allowed
in cases, the time went up to 800ms. A very dramatic shift. One note is that
there was almost no difference in having the loop inside the CFSCRIPT block
or outside.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists