Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is an interesting article, because SwiftUI has a lot of constraints and quirks (which I definitely will not go into here) but it identifies performance specifically as something they ran into problems with. SwiftUI, like all "reactive" frameworks, specifically tries to make your UI a function of state, trying to "logically" redraw everything so that it's always up-to-date. Obviously, this kind of UI is untenable so it will try to form a dependency graph of what needs updating and change only that.

The issue is that Apple sort of claims that this is all you really need to do, and that the framework will kind of handle it for you. In reality you need to be really careful about what's being updated to avoid spurious updates. Actual SwiftUI code for anything non-trivial necessarily requires some manual debouncing and equatable checks. I hear React Native often has the same issue, but there people have experience with applying memo when necessary. With SwiftUI it's considered "advanced" and bites people before they really know how to deal with it. And, of course, that's assuming that the dependency graph is working correctly: if it's not, you're often stuck and there's often not much you can do.



Not only spurious updates, this kind of architecture generates tons of garbage every couple of seconds, which at least Swift can improve thanks to its support for value types.

React and Jetpack Compose aren't so lucky, having to rely on the underlying optimizations of JS engines and ART, on escape analyis and GC algorithms.

I never understood the love for reactive for interactive GUIs, when they are so bad in memory management and its effects to jank.


Is it really that bad (the garbage generation)? Modern GCs are insanely good, short-lived objects can be quite cheap.

Also, aren’t they basically push-based reactive frameworks? I would assume they just call a bunch of registered functions and that’s it. The graph itself shouldn’t change too often (and may be static as well, eg. React vs SolidJS) — but I am way out of my depth here.


They are extremely good, however they are even better if we don't throw waste at them.

The most performance code is the one you don't have to execute.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: