Skip to content

Comments

Replace stateIn with DerivedStateFlow in ChannelMutableState (perf im…#5083

Merged
DanielNovak merged 2 commits intodevelopfrom
replace_state_in
Nov 23, 2023
Merged

Replace stateIn with DerivedStateFlow in ChannelMutableState (perf im…#5083
DanielNovak merged 2 commits intodevelopfrom
replace_state_in

Conversation

@DanielNovak
Copy link
Contributor

@DanielNovak DanielNovak commented Nov 21, 2023

Performance improvement - this has a measurable impact on cold application start and on loading of new channels, on a Pixel 4a it can save a few percent of the time needed to display the first channels.

Also stateIn with Eagerly option creates never ending coroutines which is also not memory or resource effective.

We are always combining or mapping just StateFlows so we can just use a DerivedStateFlow helper function that will give us back a StateFlow (instead of a Flow like the normal combine / map functions).

@DanielNovak DanielNovak added performance Any kind of performance problems: rendering, parsing, reading/writing v6 labels Nov 21, 2023
@DanielNovak DanielNovak requested a review from a team as a code owner November 21, 2023 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Any kind of performance problems: rendering, parsing, reading/writing v6

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants