Hey folks,
Seeing as I was finally forced to change from digest to immediate (damnit ;)
I thought I'd send out another request for more optimization tips. I'm
mostly looking for Cold Fusion tips... Things like NT & SQL Server configs
would only serve to scare me. Although... I wonder if anyone ever made a
list of things that were wrong with 4.0.1 on Solaris and how to fix them...
Anyways, here's my current list of CF knowledge that I force pitiful
underlings to obey. Hopefully we'll get some kind of compilation going.
Ed Toon.
-----------------------
Use cfscript wherever possible, for as long as possible
Boolean evaluation wherever possible
Scope all the variables that you can
Use cfmodule instead of short hand annotation for custom tags
Use cfinclude instead of cfmodule wherever possible
Use cfquery's instead of cfinserts, etc.
Cache queries that seldom change and are universal to all users of the site
Use stored procedures for non-cacheable queries
Make sure your queries are return only what you need
Always name rows in queries, instead of select *
<cfset #x# = "#Func(y)#"> is bad
<cfset x = Func(y)> is good
<cfscript>x = Func(y);</cfscript> is spiffy keen
Ise functions instead of operators wherever possible, e.g. Find/FindNoCase
instead of CONTAINS, CompareNoCase instead of "var is 'whatever'
CFHTTP resolveUrl=yes does DNS lookups -- slow
Locale functions (LSFunc) are slower than English-only functions
Cache queries with the same return every time
Prepublish pages that are the same every time
<cftag name="foo" value="#var#"> is slower than <cftag name="foo"
value=#var#>
Use cfswitch instead of cfif
Use IIF to avoid deeply nested if statements. Avoid IIF otherwise
Structures are referenced, but arrays are copied, so if you're using large
arrays and you try to do something like LocalCustomerArray =
DataStore.CustomerArrays[CustomerID] you'll end up copying the entire array,
which is ok if you just want the data, but is never gonna change the
DataStore unless you do DataStore.CustomerArrays[CustomerID] =
LocalCustomerArray again. think twice before copying big arrays
Arrays are dynamic (and they start at 1!)... thus you can't count on
myArray[15] continuing to be myArray[15] for very long.
CFLOCK all references to Session variables
CFLOCK all references to Application, Server and Request variables that
might be altered
over the life of the [Application,Server,Request]
Consider using <cfsetting enablecfoutputonly="yes"> or automatic whitespace
reduction to reduce overall page size. cfsetting is faster if it's only done
a few times, but if it ends up getting set fifty times in the course of
processing one request, you probably want automatic reduction
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
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.