1

I know that this very biased and subjective but please hear me out. And if it doesn't make any sense to you then please help me improve my question.

As every Salesforce dev, I'm slowly trying to get into LWC and so far I think that the overall design is much better when compared to Aura as it actually feels like JavaScript (and not some weird component invention). But what sometimes really baffles me is how easy LWC breaks and/or suffers from performance issues. And by that, I mainly speak about the Salesforce UI itself - not custom written components.

To give you a very recent example from the beginning of this week: I opened the process builder with only a couple of flows, opened one of them, and then tried to edit one of the elements there. When the process builder should actually open a modal dialog it just did not. I clicked maybe 10 times or so while always waiting for it to react. Nothing happened. Then I tried to do anything else - clicking e.g. the menu on the right side. Still nothing. After 60-90 seconds (I'm not kidding you!) 10 modal dialogs appeared on top of each other. I closed all of them one after another - then I got a hardcore exception, telling me that everything broke and that I should reload the whole thing.

While this was my most extreme example to date this is roughly what always happens if Lightning breaks. I cannot click or the clicks behave in a weird way - then the UI goes apeshit. And it all closes with a nice error that basically conveys: "Please press F5 to fix everything!"

Even if it doesn't go so bad - the experience (and performance) sometimes is extremely depressing. For example - I open up maybe 5-6 tabs (using Chrome) that are utilizing LWC at the moment. Memory usage goes up and the browser becomes slow and stops responding. Sometimes these tabs even crash. When I'm done and I close them all everything goes back to normal. As a human that has a serious problem with tabs, often opening hundreds of tabs at the same time (which is a completely different story), I'm just baffled how just a few tabs with Lightning components can break my browser so badly. And this even happens for Salesforce websites (Trailhead, etc.) that utilize LWC here and there (although not as badly).

Somehow I thought these were just my personal issues because so far I do not have much experience with LWC yet - but since I just had this huge problem I spoke to some of my LWC dev colleagues that are way more experienced than I am. Turns out - they have the same problems. Just not as severe as I have.

So I'm really wondering: Am I doing something wrong? Is there something fundamentally not quite okay-ish with LWC? Are the problems I should know about? Because - how can I trust LWC and components I develop if not even the own Salesforce UI is free from severe problems and/or just fails spectacularly?

I really hope some people with way more experience than me can shine some light on this.

3
  • 1
    TBH this isn't really the right forum for your question as it is really very broad rather than specific. What I would say is that a significant portion of the Salesforce lightning UX is still Aura based. Aura is known to have significant performance issues. In my experience, LWC is 1. faster, 2. easier to develop.
    – Phil W
    Nov 8, 2020 at 17:19
  • That's precisely why I was asking for improvement, as the real culprit here is very hard for me to pin down. Maybe it's just Aura that is the problem here. And if I should not ask it here - where should I ask it then? Thanks for your feedback!
    – Semmel
    Nov 8, 2020 at 18:58
  • No, LWCs have poor performance, especially compared to other modern front end frameworks and ecosystems. They're the dark ages of programming.
    – Andy Ray
    Feb 3, 2021 at 1:50

1 Answer 1

4

LWC itself is based on the Web Components standards. What this means is that the browser itself supports these components, similar to how a "video card" supports 3D primitives to improve performance. It is also considered stable at this point, and is now actively replacing previously Aura-based components.

As such, loading components is almost comparable to loading native HTML elements. They have CSS isolation provided by the browser, black box API functionality, etc. In fact, the core LWC runtime is only 7kb (minified), meaning it's much smaller than the average CSS file or most other libraries (compare, for example, jQuery, which weighs in about 200kb).

That said, the Salesforce UI is not yet all written in LWC, though many components are. They use the slower Aura engine, which is akin to comparing Flash to C++. While Flash does use hardware acceleration, the actual code runs in an emulated environment, and is thus much slower than C++ would be (the trade off, of course, is cross-platform functionality). In fact, before Java had a JIT (Just-In-Time compiler), it suffered the same problems. It simply couldn't compete with native binaries.

Right now, given the mix of Aura and LWC, a single Salesforce tab may require 1GB or more of memory. The system requirements suggest 8GM of system memory, with at least 3GB free for Salesforce. So, if you're opening a dozen tabs, you should have approximately 41GB of memory installed on your device. As LWC fills up the rest of the UI, the memory and CPU requirements will decrease, but just keep that in mind. If you're opening up a ton of tabs, you would be better off setting up a Lightning Console so you can open many records at once.

TL:DR; LWC is performant, and stable (I've even written a Conway's Game Of Life in LWC), but the UI is not all LWC, and requires significant resources to run even a single tab. You should not try to run many copies of Salesforce at once unless you have a very beefy system.

3
  • So it seems that LWC really isn't the culprit here after all and it's just the legacy of Aura that leads to these problems. I wonder if there's actually a way to know when you're dealing with Aura vs. LWC. Anyway - thanks for your very detailed answer! Basically answered all of my questions.:)
    – Semmel
    Nov 8, 2020 at 19:17
  • 1
    Open the browser console and you will see where there is aura code still hanging around. Explore the sources tab and you should be able to work out what's what.
    – Phil W
    Nov 8, 2020 at 19:48
  • I tried it and it works. This should help me to narrow it down. Thanks for the help!
    – Semmel
    Nov 9, 2020 at 22:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .