Hacker News new | ask | show | jobs
by gnlrtntv 1385 days ago
The cost here is not from rendering speed — as you point out, UI rendering is so fast in most modern environments, even on a bad day, that drawing the UI itself is pretty much never the actual load that slows anything to a crawl.

Based on the author's description, it sounds like the real cost here was from way over-diffing a set of models that weren't very efficiently bound to the UI. This is a very common source of bugs in all declarative frameworks.

In SwiftUI, the consequences can be particularly bad, because there are a couple somewhat innocent-sounding ways of injecting dependencies into your UI that actually invalidate the whole thing on any value's change and cause major updates (including, if a custom "Representable" that uses its own GPU tools is not implemented carefully, potentially reallocating all kinds of buffers and drawing tools).

This is all stuff that you learn how to deal with as you get used to the framework and learn its more advanced tools, but adapting to this part is not really something there's a lot of documentation for.