the reason i said that was y'all reemed me about 6 months ago on that and everyone went off about how much better cfcase & cfswitch were, so now its not?
---------------------------------------- From: Barney Boisvert <[EMAIL PROTECTED]> Sent: Friday, January 28, 2005 8:39 PM To: CF-Talk <cf-talk@houseoffusion.com> Subject: Re: better way to code? Actually, I did some reasonably comprehensive tests on CFMX 6.1 sometime last year, and found that this was NOT the case with CFMX's implementation of CFML. Using CFSWITCH was noticably slower. I don't remember the specifics for sure, but around 30% slower seems familiar for some reason. Note that for a single operation (one iteration of my test loop) the execution time was zero or one milliseconds almost every time, so for a single execution pass, the difference is unmeasurable. At the very least, you are guarenteed that CFSWITCH cannot be compiled into a Java switch statement, because the Java variety only allows integer values, and CFML lets you have anything. So it's safe to assume that CFSWITCH ends up as a bunch of if..else if..else statements in the compiled Java bytecode. It seem that the CFML-to-Java translation is more efficient for CFIF than for CFSWITCH, hence the speed difference. I'm pretty sure this result is different than CF5's behaviour. It's also quite possible that BlueDragon, and/or Blackstone will have CFSWITCH executing faster than CFIF, but I don't know anyone who has tested. However, the speed differences are pretty meaninless. Readable code should be the determining factor for which you select, because the long-terms savings from readable code will be way more than the handful of microseconds you might save. cheers, barneyb On Fri, 28 Jan 2005 19:36:24 -0500, Claude Schneegans wrote: > >>It's good to keep in mind that CFSWITCH/CFCASE tests for multiple > values of the same expression, CFIF/CFELSEIF tests for multiple conditions. > > Abolutely, this is why CFCASE may be more efficient than CFIF/CFELSEIF > if the expression is the same. > But a CFIF/CFELSE also evaluates only one expression and is more logical > to use than a CFCASE with only two cases. > -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 6 invites. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192149 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54