Visualforce Developer Guide
Winter '26 (API version 65.0)
Summer '25 (API version 64.0)
Spring '25 (API version 63.0)
Winter '25 (API version 62.0)
Summer '24 (API version 61.0)
Spring '24 (API version 60.0)
Winter '24 (API version 59.0)
Summer '23 (API version 58.0)
Spring '23 (API version 57.0)
Winter '23 (API version 56.0)
Summer '22 (API version 55.0)
Spring '22 (API version 54.0)
Winter '22 (API version 53.0)
Summer '21 (API version 52.0)
Spring '21 (API version 51.0)
Winter '21 (API version 50.0)
Summer '20 (API version 49.0)
Spring '20 (API version 48.0)
Winter '20 (API version 47.0)
Summer '19 (API version 46.0)
Spring '19 (API version 45.0)
Winter '19 (API version 44.0)
Summer '18 (API version 43.0)
Spring '18 (API version 42.0)
Winter '18 (API version 41.0)
Summer '17 (API version 40.0)
Spring '17 (API version 39.0)
Winter '17 (API version 38.0)
Summer '16 (API version 37.0)
Spring '16 (API version 36.0)
Winter '16 (API version 35.0)
Summer '15 (API version 34.0)
Spring '15 (API version 33.0)
Winter '15 (API version 32.0)
Spring '14 (API version 30.0)
Investigate Performance Issues
Follow Visualforce Design Guidelines
Control Data Size
Cache Frequently Accessed Data
Lazy Load Page Components
Handle Multiple Concurrent Requests
Write Efficient Apex and SOQL
Write Efficient Getter Methods
Optimize Lists and Tables
Optimize the View State
Optimize HTML
Optimize CSS
Optimize JavaScript
Optimize Images
Prevent Fields from Dropping Off the Page
Use the immediate Attribute Carefully
Visualforce Performance Case Study
Best Practices for Accessing Component IDs
Best Practices for Static Resources
Best Practices for Controllers and Controller Extensions
Best Practices for Using Component Facets
Best Practices for Page Block Components
Best Practices for Rendering PDF Files
Best Practices for <apex:panelbar>
Documentation Typographical Conventions
Best Practices for Improving Visualforce Performance
Learn strategies to improve the performance of
Visualforce
pages.
Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.
Note
-
Investigate Performance Issues
Visualforce is designed to provide developers with the ability to match the functionality, behavior, and performance of standard Salesforce pages. If your users experience delays, unexpected behavior, or other issues specifically around Visualforce, first investigate the possible sources of the problem. -
Follow Visualforce Design Guidelines
To optimize Visualforce page performance, design task-centric pages, use standard objects and declarative features, and flatten component hierarchies. -
Control Data Size
Visualforce pages have a 15-MB standard response limit, and smaller pages load faster than larger pages. To minimize load times, limit the amount of data that each page displays. -
Cache Frequently Accessed Data
Cache any data that is frequently accessed, such as icon graphics, and cache global data in custom settings. -
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. -
Handle Multiple Concurrent Requests
Concurrent requests are long-running tasks that can block other pending tasks. To reduce delays, move code to asynchronous code blocks when possible and make sure action methods that use the <apex:actionPoller> component are lightweight. -
Write Efficient Apex and SOQL
To improve the overall performance of a Visualforce page, write efficient Apex and SOQL. -
Write Efficient Getter Methods
Visualforce requests evaluate expressions, action attributes, and other method calls. A request such as a form submission can call the getter methods in a class multiple times. With more efficient getter methods, you can prevent unnecessary lookups of the same record. -
Optimize Lists and Tables
To improve the performance of Visualforce pages with lists and tables, limit the amount of data displayed per page and reduce the number of editable fields per table. You can also implement pagination or replace an <apex:pageBlockTable> component with a static HTML table. -
Optimize the View State
To maintain a Visualforce page’s view state, Lightning Platform stores the state of components, field values, and the controller as an encrypted string in a hidden form element. The view state has a limit of 170 KB. A large view state requires longer processing times for each request, including serialization and deserialization time, and encryption and decryption time. If you reduce the view state size, then your page can load faster and stall less often. -
Optimize HTML
On the server side where Visualforce validates HTML, optimized HTML improves processing efficiency. On the client side, optimized HTML makes a Visualforce page more responsive in the user’s browser. -
Optimize CSS
To ensure efficient delivery to the client, optimize the CSS in a Visualforce page. Optimized CSS also improves caching and reduces load times. -
Optimize JavaScript
To ensure efficient delivery to the client, optimize the JavaScript in Visualforce pages Optimized JavaScript also improves caching and reduces load times. -
Optimize Images
Images are frequently the largest components of a web page, so they significantly affect a Visualforce page’s performance. -
Prevent Fields from Dropping Off the Page
Visualforce pages with many fields, especially those with large text area fields or with master-detail relationships to other entities, can fail to display every field requested. Data can be dropped because of batch limits and limits on the size of data returned. To prevent fields from dropping off the page, reduce the number of fields displayed. Alternatively, create a controller extension that can query child records and display the results in related lists. -
Use the immediate Attribute Carefully
Visualforce components with the immediate attribute set to true execute an action without processing any validation rules for the associated fields on the page. This attribute should only be used if the component executes an action that navigates away from the page after completion. -
Visualforce Performance Case Study
To understand how Visualforce performance optimizations work together, examine ways to reduce the load time of a page with a large data grid and a complex object hierarchy.