Home > Articles > Mobile Application Development & Programming > HTML5 & Web Standards

  • Print
  • + Share This
From the author of

From the author of

Speed and Performance

The following items are miscellaneous factors that can speed your performance and encourage durability and scalability in your applications.

Rewrite Your Page If It Is Slower Than 2000 Milliseconds

Two thousand milliseconds (two seconds) is the limit. If you use debugging output (as you should), then you will be able to gauge how long it takes CFAS to process your request. I did not write "page" because you may have many levels of included files, queries, and so on that all have to run to make up a single request. If any request takes longer than 2000 milliseconds, it's a candidate for rewriting. We can generally exclude from this rule operations that you know will take a long time and rely on external factors, such as a <CFHTTP> call.

Use <cfswitch> Instead of <cfif>

This rule makes sense only on two occasions (though these are frequently confronted):

  1. When you have a specific expression that you can evaluate against

  2. When you have a set of more than three <cfelseif> clauses

Your code will perform faster.

Use <cfscript> Instead of Three or More <cfset>s

The reason is this: When you use cfscript, the entire block gets sent to the engine at once. So, ColdFusion has to make only one read. When you send three or more <cfset> statements, ColdFusion gets to interpret them once each, or three times. Therefore, it's faster and cleaner.

Eschew IIF

The "immediate if" function (IIF) will process nearly two times slower than a cfif/cfelse block that accomplishes the same thing. Moreover, these are harder to read.

  • + Share This
  • 🔖 Save To Your Account