Skip to content

Commit 475492b

Browse files
committed
Readme
1 parent 51a23ff commit 475492b

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
# swiftui-hierarchical-list-performance
1+
# SwiftUI Hierarchical List Performance
2+
3+
This is a demo project that highlights performance issues with hierarchical SwiftUI lists.
4+
5+
There are three main problems:
6+
7+
1. Rendering of the list is slow if there are many items. (Just start the app and wait for the list to be rendered.)
8+
2. Changing the selected item is very slow. (Tap/Click an item and wait for the selection to change.)
9+
3. Updating the list is slow. (Press the "Shuffle" button.)
10+
11+
On an iPhone 13 Pro, it takes 6 seconds from tapping the app icon to the list being rendered. This was timed with a release build.
12+
Once the list has been rendered, it takes 8 seconds for the selection to change when tapping an item.
13+
Tapping the "Shuffle" button results in a 2 seconds delay before the updated list is rendered.
14+
15+
All three problems are much more pronounced on macOS (tested on a Mac Studio M2) where it even takes minutes(!) for the app to become responsive.
16+
17+
Instruments shows that 99% of the CPU time is spent somewhere deep inside SwiftUI.
18+
Various attempts have been made to fix the problems (as documented in the code) but none of them have been successful.

SwiftUIHierarchicalListPerformance.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
E74F28F62C62027700370C35 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E74F28F52C62027700370C35 /* ContentView.swift */; };
1212
E74F28F82C62027800370C35 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E74F28F72C62027800370C35 /* Assets.xcassets */; };
1313
E78A9C232C62031000AA2FF2 /* ListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = E78A9C222C62031000AA2FF2 /* ListItem.swift */; };
14+
E78A9C252C62267600AA2FF2 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = E78A9C242C62267600AA2FF2 /* README.md */; };
1415
/* End PBXBuildFile section */
1516

1617
/* Begin PBXFileReference section */
@@ -20,6 +21,7 @@
2021
E74F28F72C62027800370C35 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
2122
E74F28F92C62027800370C35 /* SwiftUIHierarchicalListPerformance.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SwiftUIHierarchicalListPerformance.entitlements; sourceTree = "<group>"; };
2223
E78A9C222C62031000AA2FF2 /* ListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListItem.swift; sourceTree = "<group>"; };
24+
E78A9C242C62267600AA2FF2 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
2325
/* End PBXFileReference section */
2426

2527
/* Begin PBXFrameworksBuildPhase section */
@@ -36,6 +38,7 @@
3638
E74F28E72C62027700370C35 = {
3739
isa = PBXGroup;
3840
children = (
41+
E78A9C242C62267600AA2FF2 /* README.md */,
3942
E74F28F52C62027700370C35 /* ContentView.swift */,
4043
E78A9C222C62031000AA2FF2 /* ListItem.swift */,
4144
E74F28F32C62027700370C35 /* DemoApp.swift */,
@@ -111,6 +114,7 @@
111114
isa = PBXResourcesBuildPhase;
112115
buildActionMask = 2147483647;
113116
files = (
117+
E78A9C252C62267600AA2FF2 /* README.md in Resources */,
114118
E74F28F82C62027800370C35 /* Assets.xcassets in Resources */,
115119
);
116120
runOnlyForDeploymentPostprocessing = 0;

0 commit comments

Comments
 (0)