Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve stableness #1040

Merged
merged 7 commits into from
Jul 17, 2023
Merged

Conversation

MV-GH
Copy link
Collaborator

@MV-GH MV-GH commented Jul 15, 2023

Improve stableness of many composables. The root cause is navHostController. It is considered unstable

"skippableComposables": 549, -> 582
"knownUnstableArguments": 393, ->234
examples of before

restartable scheme("[androidx.compose.ui.UiComposable]") fun PostEditActivity(
  stable postView: PostView
  unstable accountViewModel: AccountViewModel
  unstable navController: NavController
)

restartable scheme("[androidx.compose.ui.UiComposable]") fun CommunityListActivity(
  unstable navController: NavController
  unstable accountViewModel: AccountViewModel
  stable selectMode: Boolean = @static false
  stable siteViewModel: SiteViewModel
  stable blurNSFW: Boolean
  stable drawerState: DrawerState
)

after

restartable skippable scheme("[androidx.compose.ui.UiComposable]") fun PostEditActivity(
  stable postView: PostView
  stable accountViewModel: AccountViewModel
  stable appState: JerboaAppState
)

restartable skippable scheme("[androidx.compose.ui.UiComposable]") fun CommunityListActivity(
  stable appState: JerboaAppState
  stable accountViewModel: AccountViewModel
  stable selectMode: Boolean = @static false
  stable siteViewModel: SiteViewModel
  stable blurNSFW: Boolean
  stable drawerState: DrawerState
)


Metrics files
compose_metrics_old.zip
compose_metrics.zip

Also redid the baseline profiles

I have still many ideas, but I ll keep those for other PRs. This one is big enough already.

MV-GH added 4 commits July 13, 2023 19:59
# Conflicts:
#	app/src/main/java/com/jerboa/MainActivity.kt
#	app/src/main/java/com/jerboa/ui/components/community/CommunityActivity.kt
#	app/src/main/java/com/jerboa/ui/components/home/BottomNavActivity.kt
#	app/src/main/java/com/jerboa/ui/components/home/HomeActivity.kt
#	app/src/main/java/com/jerboa/ui/components/person/PersonProfileActivity.kt
#	app/src/main/java/com/jerboa/ui/components/post/PostActivity.kt
#	app/src/main/java/com/jerboa/ui/components/post/PostListing.kt
#	app/src/main/java/com/jerboa/ui/components/post/create/CreatePostActivity.kt
Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, and this works well. Thx especially for moving the navcontroller out of the composables.

I'll let @twizmwazin look this over before merging.

@@ -33,7 +31,7 @@ class LoginViewModel : ViewModel() {
fun login(
instance: String,
form: Login,
navController: NavController,
onGoHome: () -> Unit,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, that's unfortunate that the navController can't be passed down and causes rerenders. But I like how you've done this, its cleaner anyway.

@twizmwazin twizmwazin merged commit 9f0d212 into LemmyNet:main Jul 17, 2023
@MV-GH MV-GH deleted the feat/recomposition_changes branch July 17, 2023 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants