---
schema_version: "1"
id: 11ab9212ae0cb2846fdf57e410af993a4f4a0326e4e7569bd610ffb3c887f778
title: Best Practices for Improving Visualforce Performance
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-pages-developers-guide/guides/pages/best-practices/best-practices-performance/pages-best-practices-perf-intro.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-intro.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: f00ba238f70bc7d10fe4ed334153377c84e530a589ab359b0c316917da57ddcc
products:
  - Visualforce Developer Guide
  - Platform Developer Content
---

# Best Practices for Improving Visualforce Performance

Learn strategies to improve the performance of Visualforce pages.

**note:** 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.

-   **[Investigate Performance Issues](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-investigate.md)**  


    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](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-design.md)**  


    To optimize Visualforce page performance, design task-centric pages, use standard objects and declarative features, and flatten component hierarchies.

-   **[Control Data Size](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-data-size.md)**  


    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](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-cache.md)**  


    Cache any data that is frequently accessed, such as icon graphics, and cache global data in custom settings.

-   **[Lazy Load Page Components](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-lazy-load.md)**  


    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](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-concurrent.md)**  


    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](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-apex-soql-.md)**  


    To improve the overall performance of a Visualforce page, write efficient Apex and SOQL.

-   **[Write Efficient Getter Methods](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-getters.md)**  


    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](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-lists-tables.md)**  


    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](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-view-state.md)**  


    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](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-html.md)**  


    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](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-css.md)**  


    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](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-javascript.md)**  


    To ensure efficient delivery to the client, optimize the JavaScript in Visualforce pages Optimized JavaScript also improves caching and reduces load times.

-   **[Optimize Images](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-images.md)**  


    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](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-prevent-fields.md)**  


    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](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-immediate-attr.md)**  


    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](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-best-practices-perf-case-study.md)**  


    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.


