A great way to determine the actual efficiency of a piece of code is to put
it in a loop. Looping over the code multiple times makes the actual
numbers more meaningful by ruling out time associated with connections and
CF administrative overhead.
Specific things to look for include using CFSWITCH for anything more than 3
comparisons, using CFSCRIPT for multiple cfsets (but not loops or
comparisons), caching queries and/or creating customized structures for
commonly accessed information. More efficient code is more of an art than
a series of recipes. Good luck!
Sharon
At 02:12 PM 4/11/2000 +0100, Ben Lowndes wrote:
>Hi,
>
>I'm trying to make some of my scripts as efficent as possible. The script
>contains quite a few conditions and nests down to about 4 levels in most
>places.
>
>I've tried swapping if-else statements for nested sitch-case. Then
>repeatedly running the same query a number of times. Watching the Execution
>time useing switch-case averages about 250milliseconds where as if-else
>averages about 270milliseconds.
>
>Is there a more "scientific" way of evaluating code efficeny and are there
>any resources with tips about writing the most efficent code? For example
>would it be better for me not to cfinclude pages if I'm more concerned about
>efficency than code reusability or readability??
>
>Thanks
>Ben
>
>------------------------------------------------------------------------------
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.