5 ms·
Why are web apps so much worse performance-wise than cross-platform UI toolkits? Is it a result of the web’s historical baggage, or are the tradeoffs inevitable
by Siira 5y ago
Why are web apps so much worse performance-wise than cross-platform UI toolkits? Is it a result of the web’s historical baggage, or are the tradeoffs inevitable?
- jolux 5y agoIt depends. I have no idea why Microsoft Teams has such terrible performance on my Mac, for example. Slack is perfectly performant. If there's a general ("inevitable") reason it's that updating the DOM (i.e., adding, removing, and changing HTML elements) is very slow compared to the function calls that native apps use to draw on the screen. That's why frameworks like React are designed to update the DOM as minimally as possible. It's also why Figma is written in C++ that compiles to WebAssembly and draws its content with WebGL instead of using the DOM.
- Siira 5y agoMy guess was the DOM, too. But why does the DOM only exist in the web UI tech stack? There aren’t analogous constructs in other UI stacks (e.g., Windows Presentation Foundation), are there?
- elpescado 5y ago> But why does the DOM only exist in the web UI tech stack? Maybe because "web UI stack" wasn't designed for "UI". It was designed for hypertext documents and DOM is a perfectly cromulent way to represent a HTML document.
- jolux 5y agoI think the biggest difference is just that the layout algorithm for the DOM is a lot more complex than those for native apps. Changing one element might reflow the whole page. Native frameworks aren't like that, and the solution they're converging on is the one React pioneered for the web, which is making a control's data dependencies explicit so you know when it needs to be updated.
- elpescado 5y ago> Slack is perfectly performant. I wouldn't call Slack performant. It sometimes struggles with basic things such as scrolling channel list. And it always lags with repainting window when its resized (when you resize window, extra space is left blank until Slack catches up - this never happens on native apps).