Ah... the Evil Whitespace...

All CFSETTING does is remove any white space that "CF puts in".  If you love
indented web pages and use this extensively for your HTML, CF didn't put it
in, YOU DID.  If, however, a CF tag, once processed, would introduce space,
CF will do string processing to remove the space from the page.  If you do a
lot of this in your page, stripping some of the empty space could make a
difference, especially if you have 30+ lines of query statements, CFPARAMs,
etc. at the top of every page.  If your pages are fairly light on CF but
have tons of tabs, CFSETTING won't really help you.

So why bother using CFSETTING at all?  Well, if you have a ton of CF code
throughout your site, especially CFOUTPUTs utilizing queries or CFLOOPs, you
are actually creating lots of activity in these parts of your page and white
space may occur as a result.  Removing this on complex pages or those with a
lot of data, may very well shrink your web pages by a large amount.  If so,
ON THOSE PAGES, you should consider removing white space.

Consider also what you'd ask CF to do if you asked it to remove absolutely
every instance of tabs, extra spaces, etc.  You'd be doing the equivalent of
a REPLACE function which is a string operation, arguably the slowest
possible operation a language undertakes (if you rule out external accesses
to slow systems - CFHTTP for example).  This could dramatically impact your
CPU.

The CF Admin remove whitespace function essentially is the same thing as
putting CFSETTING at the beginning of EVERY page in your server.

Allaire recommends that you NOT do this because, let's face it, not all of
your pages are going to benefit from having the white space removed.  So, if
you tell CF to remove white space from ALL of your pages, it's doing a lot
of extra work for little or no benefit in most cases.

So what's the best approach?  My suggestion is to run a page, do a
Properties check on it to see how big the resulting file is.  Save that file
to your PC and then do a manual search/replace on all tabs and double spaces
(not singles or sentences will be affected).  Save the file and see how much
smaller it is.  If it's 1-2k you might not want to worry about it depending
on your server's capacity and how busy your site is.  If, however, the
difference is several k, you might want to tune this page up because
multiplied by thousands of page views, you're wasting megabytes of bandwidth
and causing users to wait even longer for the rest of your site to start
downloading.

That's my two cents... I hope it helps.

--Doug

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to