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

[Compose] Parse LottieComposition synchronously instead of using LottieTask #1888

Merged
merged 2 commits into from
Sep 3, 2021

Conversation

gpeal
Copy link
Collaborator

@gpeal gpeal commented Sep 3, 2021

Using LottieTask under the hood incurred several extra thread hops including a main thread post. Switching it to a result like this is both faster and also enables custom factories to be used. From my initial tests, this cut the parse time for the heart animation in the repo roughly in half.

Unfortunately, LaunchedTask takes a few ms to start. I tried with rememberCoroutineScope().launch and the initial delay was the same so I'm not sure if there is anything else that can be done here.

Fixes #1880

@LottieSnapshotBot
Copy link

Snapshot Tests
28: Report Diff

@gpeal gpeal merged commit c8c6997 into master Sep 3, 2021
@gpeal gpeal deleted the gpeal/init-perf branch September 3, 2021 23:10
gpeal added a commit that referenced this pull request Sep 8, 2021
gpeal pushed a commit that referenced this pull request Sep 8, 2021
gpeal added a commit that referenced this pull request Sep 8, 2021
…ing LottieTask" (#1890)

Reverts #1888

This was not a good solution. It lost task joining so requesting the same animation multiples would parse the animation multiple times.
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.

LottieCompositionFactory.fromRawRes is not helping in Composable LottieAnimation
2 participants