|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Stripping tabs/linebreaks/spacing on a high traffic production serverWe 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:328028 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4 |
|
|
Re: Stripping tabs/linebreaks/spacing on a high traffic production serverA couple tags that are realy useful for stripping whitespace are the <cfsilent></cfsilent> block and the <cfsetting enableCFoutputOnly = "true">. You can also make use of the <cfprocessingdirective supressWhiteSpace="yes"> and the setting in the ColdFusion administrator that has a similar affect. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:328033 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4 |
|
|
Re: Stripping tabs/linebreaks/spacing on a high traffic production serverbefore you go into minimizing whitespace, you should really remove all those <cfoutput> tags from around code that does not have any cf variables in it. that will speed up the page somewhat since cf will not have to parse your html looking for non-existent cfml in it... wrapping all your code in <cfprocessingdirective suppresswhitespace="yes"></cfprocessingdirective> will help reduce whitespace (especially cf-generated whitespace), too. minifying your js and css can further reduce loading times. hth Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ On 05/11/2009 02:26, Jeff Gladnick wrote: > 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:328035 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4 |
|
|
Re: Stripping tabs/linebreaks/spacing on a high traffic production serverYes, 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.gladnick@...> > > 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=17837.14401.4 |
|
|
Re: Stripping tabs/linebreaks/spacing on a high traffic production serverOh, and if you haven't already, install the YSlow and Pagespeed addons for Firefox to analyze your pages. Their feedback can get you to the heart of any client side problems very quickly. Server side, I wouldn't be so concerned by the whitespace and more concerned by slow running queries and code. Dominic 2009/11/4 Jeff Gladnick <jeff.gladnick@...> > > 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:328039 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4 |
|
|
Re: Stripping tabs/linebreaks/spacing on a high traffic production serverOn Thu, 2009-11-05 at 04:11 +0800, Azadi Saryev wrote: > before you go into minimizing whitespace, you should really remove all > those <cfoutput> tags from around code that does not have any cf > variables in it. that will speed up the page somewhat since cf will not > have to parse your html looking for non-existent cfml in it... Sorry...I'm late to the thread (not sure what version is being discussed), but the above hasn't really been an issue since pre-MX. Although a valid statement, it might save a nanosecond or 2 ;-) Personally I prefer not to open/close CFOUTPUT tags all over the place....just gets messy. Cheers - Bryan Stevenson B.Comm. VP & Director of E-Commerce Development Electric Edge Systems Group Inc. phone: 250.480.0642 fax: 250.480.1264 cell: 250.920.8830 e-mail: bryan@... web: www.electricedgesystems.com Notice: This message, including any attachments, is confidential and may contain information that is privileged or exempt from disclosure. It is intended only for the person to whom it is addressed unless expressly authorized otherwise by the sender. If you are not an authorized recipient, please notify the sender immediately and permanently destroy all copies of this message and attachments. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:328040 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4 |
|
|
Re: Stripping tabs/linebreaks/spacing on a high traffic production serverOn Wed, Nov 4, 2009 at 1:26 PM, Jeff Gladnick <jeff.gladnick@...>wrote: > > 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: > > Best Practices for Speeding Up Your Web Site The Exceptional Performance team has identified a number of best practices for making web pages fast. The list includes 34 best practices divided into 7 categories. http://developer.yahoo.com/performance/rules.html ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:328043 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4 |
|
|
Re: Stripping tabs/linebreaks/spacing on a high traffic production serverThanks for all the feedback guys. We're already doing the easy stuff (cfsilent, etc) to suppress whitespace. I'm leaning towards the caching and converting to 1 line for standard html stuff. we'll be careful with the js thanks! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:328046 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4 |
| Free embeddable forum powered by Nabble | Forum Help |