-
Notifications
You must be signed in to change notification settings - Fork 685
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 AsyncImage performance. #1048
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
colinrtwhite
added a commit
that referenced
this pull request
Oct 5, 2022
* Start optimizing. * Refactor. * Slight tweak. * Docs. * Docs. * Don't observe AsyncImagePainter.state. * Docs. * Re-arrange. * Remove parent scope. * Clean up. * Propagate min constraints for box. * Manually invoke RememberObserver callbacks. * Create a fake transition target. * Remove import. * Slight fix. * Combine. * Docs. * Fix logic. * Naming. * Fix. * Fix crossfade. * Fix preview. * Docs. * Don't depend on state by default in content. * Docs. * Fix. * Remove minor optimization. * Use custom layout implementation. * Docs. * Refactor. * Tweak. * Tweak. * Tweak. * Move back. * Add a custom content size modifier. * Tweak. * Docs. * Docs. * Add initial custom content painter modifier. * Tweak. * Tweak. * Tweak. * Refactor. * Simplify. * Fixes. * Fix. * Fix. * Docs. * Rename. * Tweak. * Tweak. * Minor fixes. * Make default cases faster. * Docs. * Support setting placeholder/error/fallback placeholders. * Docs. * Tweak. * Docs. * Docs. * Tweak. * Docs. * Guard against infinite sizes. * Rename. * Prefix. * Revert. * Match behaviour. * Docs. * Docs. * Rename. * Add loading/success/error callbacks to AsyncImage. * Tweak sample. * Fix keys. * Remove request from callbacks. * Clean up. * Use DefaultAlpha. * Refactor. * Refactor. * Refactor. * Docs. * Revert. * Add tests. * Fix preview. * Tweak. * Rename. * Add error painter. * Fix tests. * Tweak. * Docs. * Fix missing modifiers. * Add tests for recomposition. * Fix paths. * Refactor. * Use getAndIncrement. * Validate. * Validate. * Fix tests. * Performance tweak. * Tweak. * Docs. * Add more tests. * Tweak. * Fix duplicate. * Tweak. * Fix crossfade. * Docs. * Refactor. * Docs. * Docs. * Docs. * Docs. * Docs. * Docs. * Docs. * Re-arrange. * WIP. * Rename to interceptor. * Docs. * Tweak. * Docs. * Rename. * Tweak API. * Update API. * Fix tests. * Rename parameter. * Tweak.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR focuses on improving
AsyncImage
's performance through the following changes:AsyncImage
now always usesLayout
and never uses subcomposition. As a result, this PR movesAsyncImage
'sloading
/success
/error
/content
composable arguments into a new composable,SubcomposeAsyncImage
.placeholder
/error
/fallback
and callbacks foronLoading
/onSuccess
/onError
. Hopefully these arguments help users avoid usingloading
/success
/error
/content
.transform
andonState
arguments. These are more flexible ways to override thePainter
for a specific state and be notified about state changes.State
argument from thecontent
composable function so users aren't automatically opted into recomposing when the painter's state changes.AsyncImagePainter.state
insideAsyncImagePainter.kt
.There's a
coil-sample-compose
app in this repo that can be run to test out the improved scrolling performance.EDIT: Updated to reflect the newest changes as of 26/01/2022.