[SalesForce] Apex Page Attributes – Performance Impact

I would like to better understand how each of the following attributes on an apex:page tag (or any notable omissions) affect load times.

  • applyBodyTag
  • applyHtmlTag
  • docType
  • showHeader
  • sidebar
  • standardStylesheets

In my discussions with other developers, there have been a lot of hand-wavy assumptions that:

  • Setting applyBodyTag or applyHtmlTag to true is noticeably faster than false.
  • Setting showHeader, sidebar, standardStylesheets to false is noticeably faster than true.
  • Setting a docType of html-5.0 is noticeably faster than other values.

I want some concrete numbers to back up (or disprove) these assumptions. Can anyone provide them?

My interpretation of @Ashwani's findings:

  1. ~50ms <apex:page>
  2. ~35ms <apex:page applyBodyTag="false">
  3. ~ 9ms <apex:page applyHtmlTag="false" showHeader="false">
  4. ~ 7ms <apex:page applyHtmlTag="false" applyBodyTag="false" showHeader="false">
  5. ~30ms <apex:page docType="html-5.0">
  6. ~32ms <apex:page standardStylesheets="false" applyBodyTag="false">

Best Answer

I have been into the situation when deciding the view architecture. Here are some real figures based on various attributes used with <apex:page>

For example consider a page like this:

<apex:page ~~attribs~~ >
    Lot of text
    <label> I am </label>
    No adding apex tags as they have their on performance.
</apex:page>

Controller is a separate thing (has own processing) so, assume there is no controller in Visualforce page.

1. No attribute
A page with only html tags and no attribute added take around 50ms to load. Consider 50ms the default loading time of page which has no attribute set explicitly.

2. applyBodyTag attribute
applyBodyTag = false attribute significantly increases the page loading time as now its browser or the developer's work to apply body tag properly. In comparison to 50ms it takes around 35ms.

3. applyHtmlTag and showHeader attribute
This faster than applyBodyTag = false as no header needs to be rendered by Visualforce engine. In comparison to last 35ms it takes 9ms to load a page.

4. applyBodyTag and applyHtmlTag and showHeader attribute
It reduces visualforce engine processing a little. In comparison to 9ms it takes 7ms.

5. docType HTML-5.0
This is true HTML-5.0 is faster and in comparison to default (#6) it takes 30ms.

6. docType default
It is slower than #5. Figure at "#1 No attribute" is similar to this 50ms-58ms.

7. showHeader attribute
It is faster than showHeader = true.

8. sidebar attribute
When showHeader is false, sidebar automatically is false. It is faster the true values set.

9 showHeader and sidebar attribute
This is slower than showHeader and sidebar = false.

10. standardStylesheets attribute
This attribute does not make significant difference, but value = false is faster. Time will be reduces to few ms like if page take 35ms to load wit will take 32ms when set to false.

12. showHeader and sidebar attribute but no standardStylesheets
It is same as #10.

Also, longer the html text longer the processing time. More apex tags more processing time. Action functions, Action support, Remoting function and re-render increases page processing time a lot.

Related Topic