Yes, that makes plenty of sense. However, all that regex processing *could*
be a bit of a fruitless drain so, if you can, cache the page content (using
CF and compressed using the method you describe). Caching the output could
really speed things up but, of course, can be a problem if there's
session/logged-in user based output. Testing should be the decider on how
much the white space processing effects things if you can't cache your
output.

There's a udf on cflib.org to do with html whitespace stripping:

http://www.cflib.org/index.cfm?event=page.udfbyid&udfid=812

Another thing to look out for when using the 'extreme', single line
compression is that it can break some inline javascript that is missing
optional semi-colons.

HTH

Dominic
**
2009/11/4 Jeff Gladnick <jeff.gladn...@gmail.com>

>
> We have a VERY high traffic website, and we're trying to speed up the
> pageload times a bit.  One of the things we're considering is going through
> some of the cfm files that are loaded on every request and trying to strip
> them down:
>
> So for example, on the page that builds the <html> tag @ the top, we have:
> --------------
> <cfoutput><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> <html xmlns="http://www.w3.org/1999/xhtml";>
> <head></cfoutput>
>        <cfif request.showIntroAd>
>                <cfoutput><meta http-equiv="refresh"
> content="#request.site.introAdDisplayTime#;http://
> #CGI.HTTP_HOST##request.loader.geturi(request.object.id,request.page)#<cfif
> CGI.query_string neq "">?#CGI.QUERY_STRING#</cfif>">
>                </cfoutput>
>        </cfif>
>        <cfoutput><meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1" />
>        <meta http-equiv="Pragma" content="no-cache" />
>        <meta http-equiv="Expires" content="-1" />
>        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
>        <link rel="icon" href="/favicon.ico" type="image/x-icon" />
>        </cfoutput>
>        <cfif (isDefined("request.isHomePage") AND request.isHomePage) or
> cgi.path_info eq "/">
>                <!--- GOOGLE SPIDER ACTIVITY DIAGNOSTIC TAG --->
>                <cfoutput><META name="verify-v1"
> content="rlf8D2GawTNaQTdKz2jo3t+cM5Bg+vVz3C7+uoCtYy4=" />
>                </cfoutput>
>        </cfif>
>
>        <cfoutput>
>        <script type="text/javascript" src="/scripts/functions.js"></script>
>        </cfoutput>
> -------------------
>
> Lots of white space in there.
>
> On some other high traffic sites I see HTML compressed into a single line
> of code.  How can we do that reliably while still making the code readable
> by developers.
>
> One thing we considered was to wrap blocks in cfsavecontent, and then use
> regex to strip out the tabs/linebreaks/etc, and save the blocks of code into
> the application scope.
>
> We are already Gzipping files.
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328037
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to