Replies: 1 comment 3 replies
-
Hi @topkim993, thanks for opening this discussion. While your project does show a stark difference in vanilla SwiftUI and TCA, there are a few important caveats to note:
The last point is very important, and it comes up a lot when trying to compare TCA to vanilla SwiftUI, so I'd like to explain a bit more. There are a number of important differences between the vanilla SwiftUI version of your feature and the TCA one.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
We're using TCA quite extensively and generally very satisfied with the architecture. However, we've recently run into a performance issue in a view that requires rendering multiple sections (order-independent), each containing a number of items.
Each item triggers an impression log when it appears. While our actual implementation has a more elaborate impression tracking system, we've simplified the reproduction case to just use .onAppear.
We've attached a minimal project that replicates the issue.
From what we can tell, the problem seems related to a high frequency of .onAppear actions, especially in sections that contain many small items. In contrast, sections with fewer large items don’t exhibit the same kind of lag.
As the number of .onAppear calls increases while scrolling, we start to see hitching and frame drops.
Questions:
Is there a recommended way to optimize .onAppear actions in TCA, especially when they are triggered at high frequency due to many small items appearing on scroll?
Also, does having a computed property for id in enum-based SectionFeature.State pose a performance risk?
Thanks in advance!
Download Example Project
Beta Was this translation helpful? Give feedback.
All reactions