Rendering performance improvements#1124
Conversation
| // as part of rendering we will re-parse each block again. | ||
|
|
||
| // This has a significant cost in list views. | ||
| Self.renderer.render(renderable.block.description) |
There was a problem hiding this comment.
Need to rethink this rendering approach at some point.
There was a problem hiding this comment.
Could we change the API here to take a Subtext instance instead? https://github.com/subconsciousnetwork/subconscious/blob/main/xcode/Subconscious/Shared/Parsers/SubtextAttributedStringRenderer.swift#L151
| colorScheme == .dark ? DeckTheme.darkBg : DeckTheme.lightBg | ||
| ) | ||
| var body: some View { | ||
| (colorScheme == .dark ? DeckTheme.darkBg : DeckTheme.lightBg) |
There was a problem hiding this comment.
It doesn't seem like much, but directly rendering a LinearGradient as a view vs. using it as a background on a frame has a massively reduced rendering cost.
27624bf to
6ff6be7
Compare
9359c71 to
ab96c0d
Compare
| .onChange(of: self.scenePhase) { phase in | ||
| store.send(.scenePhaseChange(phase)) | ||
| } | ||
| .sentryTrace("AppView") |
There was a problem hiding this comment.
Too expensive and not actually useful without forking out more money to sentry.
| .onAppear { | ||
| selectedTab = store.state.selectedAppTab | ||
| } | ||
| .onChange(of: selectedTab) { v in |
There was a problem hiding this comment.
Note: on iOS 17 we'll need to update this to
.onChange(of: selectedTab) { _, v in
// ...
}| // as part of rendering we will re-parse each block again. | ||
|
|
||
| // This has a significant cost in list views. | ||
| Self.renderer.render(renderable.block.description) |
There was a problem hiding this comment.
Could we change the API here to take a Subtext instance instead? https://github.com/subconsciousnetwork/subconscious/blob/main/xcode/Subconscious/Shared/Parsers/SubtextAttributedStringRenderer.swift#L151
ee0a142 to
6b72afe
Compare
Before
After (No Hangs!)