Plat-Dev-301 practice question 10 of 10

A Visualforce page loads slowly due to the large amount of data it displays. Which strategy can a developer use to improve the performance?

Full set: 160 questions
Answer options
A: Use the transient keyword for the List variables used in the custom controller.
B: Use lazy loading to load the data on demand, instead of in the controller's constructor. Correct answer
C: Use JavaScript to move data processing to the browser instead of the controller.
D: Use an in the page to load all of the data asynchronously.
Correct Answer:
B. Use lazy loading to load the data on demand, instead of in the controller's constructor.
Explanation

A slow initial page load due to a large dataset is best solved by reducing the amount of data queried and transmitted at once. Lazy loading is a design pattern that defers the loading of data until it is needed. Instead of querying all records in the controller's constructor, an initial, smaller subset is loaded. More data is then fetched on-demand via user actions like clicking a "Next" button or scrolling, significantly improving the initial perceived performance of the page. This is often implemented using a StandardSetController or custom Apex with offset.

Why Incorrect

A. The transient keyword reduces view state size, which improves performance on subsequent requests (postbacks), but does not affect the initial query and page load time.
C. Moving data processing to the browser doesn't solve the core issue, which is the time taken to query and transfer a large dataset from the server initially.
D. An is used for periodic, automatic refreshes of data from the server. It is not an appropriate mechanism for an initial bulk data load.

References

Salesforce Visualforce Developer Guide, "Best Practices for Improving Visualforce Performance", Section: "Working with Large Data Volumes". This section recommends using pagination with a StandardSetController or custom controllers to lazy load data.

Salesforce Architects, "Designing Record-Centric Applications on Salesforce", Section: "Data Handling Patterns". This guide discusses patterns like lazy loading for handling large data volumes efficiently.

Scroll to Top