Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Performance refactors for Posts feed#1527

Merged
dessalines merged 18 commits into
LemmyNet:mainfrom
MV-GH:recomposition-experiments
Jun 1, 2024
Merged

Performance refactors for Posts feed#1527
dessalines merged 18 commits into
LemmyNet:mainfrom
MV-GH:recomposition-experiments

Conversation

@MV-GH

@MV-GH MV-GH commented May 27, 2024

Copy link
Copy Markdown
Collaborator

Refactor to use SnapshotStateList instead of List

Before what we did was create a new list each time we change something in that list. Since compose checks on equality the list is now different and fully recomposes the entire list. Instead use SnapshotStateList which emits events for only the changes made to the list.

Many changes have made to the postlisting so that when a vote changes it doesn't recompose the entire postlisting but just the votes. This was only successful for postlisting as the card modes use postview to deeply into the "onAction" lambdas which trigger recompose as the postview has different equality.

It no longer recomposes the feed when adding/updating postviews

The collapsible header also causes recompositions as it changes the innerpadding which is applied to the lazy column. Not sure if anything can be done for that. (But only when it moves, so when u scroll down once its up, no recompositions happen) (This has been solved)

I am also going to refactor the comments. (I'll do that in a separate PR)

@MV-GH MV-GH changed the title Recomposition experiments Performance refactors for Posts feed May 27, 2024
@MV-GH MV-GH marked this pull request as ready for review May 31, 2024 14:10
@MV-GH MV-GH requested a review from dessalines as a code owner May 31, 2024 14:10

@dessalines dessalines left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Check the comments below, but my biggest concern is the fact that there are now two lists to keep track of, rather than a single snapshotstatelist.

Also the remembers are potentially bug-worthy, since source data changes might not be reflected properly. If they're necessary that's okay, but maybe they should be keyed.

Comment thread app/src/main/java/com/jerboa/feed/FeedController.kt Outdated
Comment thread app/src/main/java/com/jerboa/feed/FeedController.kt
Comment thread app/src/main/java/com/jerboa/feed/PaginationController.kt
Comment thread app/src/main/java/com/jerboa/ui/components/common/TextBadge.kt Outdated
Comment thread app/src/main/java/com/jerboa/ui/components/community/CommunityLink.kt Outdated
Comment thread app/src/main/java/com/jerboa/model/PostsViewModel.kt Outdated
Comment thread app/src/main/java/com/jerboa/ui/components/home/HomeActivity.kt Outdated
Comment thread app/src/main/java/com/jerboa/ui/components/post/PostListing.kt
Comment thread compose_compiler_config.conf Outdated
Comment thread app/src/main/java/com/jerboa/ui/components/post/PostListing.kt
MV-GH added 3 commits May 31, 2024 20:13
# Conflicts:
#	app/src/main/java/com/jerboa/model/PostsViewModel.kt
Comment thread app/src/main/java/com/jerboa/model/PostsViewModel.kt
Comment thread app/src/main/java/com/jerboa/ui/components/common/TextBadge.kt
MV-GH added 6 commits May 31, 2024 20:58
# Conflicts:
#	app/src/main/java/com/jerboa/ui/components/post/PostListing.kt
#	app/src/main/java/com/jerboa/ui/components/post/composables/PostOptionsDropdown.kt
# Conflicts:
#	app/src/main/java/com/jerboa/ui/components/community/CommunityActivity.kt
#	app/src/main/java/com/jerboa/ui/components/home/HomeActivity.kt
#	app/src/main/java/com/jerboa/ui/components/post/PostActivity.kt
#	app/src/main/java/com/jerboa/ui/components/post/PostListings.kt
Comment thread app/src/main/java/com/jerboa/model/PostsViewModel.kt
@dessalines dessalines merged commit 461f264 into LemmyNet:main Jun 1, 2024
@MV-GH MV-GH deleted the recomposition-experiments branch June 1, 2024 11:59
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.

2 participants