Came across this weird SwiftUI bug that was messing up performance.

Turns out Lists in SwiftUI (on iOS) do not truly lazy load if a section is used. It's been years since SwiftUI launched and embarrassing performance issues like these is why I regret using SwiftUI. Basic things require a workaround.

cc @dimillian

@tanmay This is interesting, so using a Section you get the init right? But you don’t get body computation until the row actually appear, also right? But without section you get the init of only the visible rows?
@dimillian Using section, the body computation of all 10k rows gets done. SwiftUI is likely doing a layout pass of the entire 10k rows to compute the section dimensions.
@tanmay This is crazy, and I feel like they do that because you can animate section update / collapse etc… But definitely a good reminder to not use Sections in long List. By the way, I’m considering splitting my status row into one section with multiple rows for each part of the status. It would allow me to have multiple context menu etc…
@dimillian That's a clever trick to enable multiple context menus. Also I believe as long as the section itself is not inside another section it should get lazy loaded, but best to test this out.
@dimillian I just tested this and it did not work. Adding a section to a list forced body computation of all rows regardless whether or not they were in a section. So if you're using a List and want to do section based status views, you’ll get worse performance.