Lazy Load Page Components
To reduce or delay expensive calculations, use lazy loading. With lazy loading, a page
loads its essential components first and delays the other features until the user performs an
action that requires the information. This technique gives users faster access to essential
features and makes a large page appear more responsive, even though the entire page takes the
same total time to load.
To lazy load parts of a Visualforce page, use the following techniques:
- Use the rerender attribute on Visualforce components to update the component without updating the entire page.
- Use JavaScript remoting to call functions in your controller and to retrieve ancillary or static data.
- Create a custom component to show and hide data according to user actions.
When you lazy load a page, consider the number of users and the amount of data you expect the page to use. Watch out for limits such as the concurrent API call limit. For example, if a navigation tree only loads elements as needed, the number of queries can end up out of proportion to the data.