Optimizing Apex code
In this section, we will discuss improvements that you can make to your server-side Apex controllers, to reduce database time and provide Lightning Components with data in an optimized format so that the framework renders the components faster.
Limiting data rows for lists
If your Salesforce SOQL query is fetching large amount of results, consider limiting the number of data rows by using a LIMIT clause and using server-side pagination.
Look for opportunities where data from the server can be lazy loaded. For example, if you have three tabs, load data only for the first tab that will be rendered on the screen. Render the data for the second tab only when a user clicks the second tab.
Reducing server response time, using the platform cache
Redundant SOQL can be expensive, and you can significantly improve performance by using the platform cache feature of the Salesforce Lightning platform. Salesforce offers two types of caching mechanisms namely Org cache and session cache...