I am just struggling to understand on this as I develop a lightning component. I have object rows from apex controller which gets displayed on the component using <table>, <tr> and <td> tags. I have written most of the logic on the component itself like disable 'select' checkbox if rec.status = completed, enable 'select' checkbox for rec.status = Open, use of different checkboxes and inputfields using <aura:if>. I was just suggested that we should implement all such kind of logic on the backend (apex) and we should use the front end just to display the records. Does this way of doing reduces the performance of the lightning component?


Lightning Component Framework is optimized for performance. So unless and until you have things really going bad, you should be good if you implement your component using Lightning Components Performance Best Practices.

Then Lightning component framework is all about building rich UI applications utilizing more of client side features. So if you really don’t use the client side features, then you will end up under-utilizing the framework.

One of the significant considerations for performance in any framework is to reduce server trips. So as long as you are efficiently handling your client side components without making unwanted server calls, you are in fact doing it the right way.

Here are few of the excerpts which you can find on documentation on Lightning Component Framework.

The benefits include an out-of-the-box set of components, event-driven architecture, and a framework optimized for performance.

Uses a stateful client and stateless server architecture that relies on JavaScript on the client side to manage UI component metadata and application data. The client calls the server only when absolutely necessary; for example to get more metadata or data. The server only sends data that is needed by the user to maximize efficiency.


Aside from Jayant's excellent answer, it's worth noting that JavaScript is faster than Apex, hands-down. Whenever Visualforce started to have issues with rendering a page, the immediate solution is to use a client-side framework, as demonstrated in this answer. In other words, the general advice is to avoid using Apex, because it is slower than client-side rendering. Do as much as possible with client-side code.

This applies for both Visualforce and Lightning, but in particular, you'll enjoy a much more responsive UI if you do as much processing as you can after getting the data back from the Apex code. Apex should only be used to perform DML operations, callouts, and describes, with minimal processing and minimal server-side logic.

However, because of the nature of Lightning, do remember that Apex should still perform sanity checks, like making sure sharing is enforced, checking CRUD/FLS permissions, and generally ensuring that the request is not manipulated. Lightning mostly protects each name space from interacting with other namespaces, but it's not necessarily immune to poorly designed components that might be manipulated by external messages, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.