[go: nahoru, domu]

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

Speed up first asset load by using the binary-formatted asset manifest for image resolution #118782

Conversation

andrewkolos
Copy link
Contributor
@andrewkolos andrewkolos commented Jan 19, 2023

Supersedes #113637/#116684. Branches off #118410.

Note for self: update #117228 and lower its priority after merge.

Context

When loading an asset for the first time, the framework has to load a file called the asset manifest, which contains information about assets available to the app (for example, where to find higher-resolution variants of images). This file is in the JSON format.

Reading the file from storage, decoding into UTF, and parsing it as JSON is generally slower than we'd like, especially since this is will all likely happen on first paint (since many apps include assets on their first screens).

#117233 updated the tool to also generate a binary-formatted version of the asset manifest. The binary-format enables faster loading and parsing of the file. This change utilizes this new asset manifest for resolving assets.

Here are the results from running the load_and_parse_large_asset_manifest benchmark on a Galaxy A02S before and after the change:

  • Before: 9608ms, 9539ms, 9508ms (average 9551.7ms)
  • After: 598ms, 422ms, 431ms (average 483.7ms)

In apps with large asset manifests, such as money (g3), running on lower-spec devices, this should hopefully result in a speed up of at least one frame when loading.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added framework flutter/packages/flutter repository. See also f: labels. team Infra upgrades, team productivity, code health, technical debt. See also team: labels. labels Jan 19, 2023
@andrewkolos andrewkolos removed the team Infra upgrades, team productivity, code health, technical debt. See also team: labels. label Jan 19, 2023
@flutter-dashboard flutter-dashboard bot added the team Infra upgrades, team productivity, code health, technical debt. See also team: labels. label Jan 19, 2023
@andrewkolos andrewkolos removed the team Infra upgrades, team productivity, code health, technical debt. See also team: labels. label Feb 2, 2023
@andrewkolos andrewkolos force-pushed the use-binary-asset-manifest-for-image-resolution branch 2 times, most recently from 29d4f98 to 62a659c Compare February 2, 2023 16:25
@andrewkolos andrewkolos marked this pull request as ready for review February 7, 2023 13:00
@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #118782 at sha 14f0564

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label Feb 7, 2023
@andrewkolos andrewkolos requested review from jonahwilliams and removed request for jonahwilliams February 7, 2023 14:27
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 23, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 23, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 23, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 24, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 24, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 24, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 24, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 24, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 24, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 25, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
@andrewkolos andrewkolos deleted the use-binary-asset-manifest-for-image-resolution branch April 21, 2023 19:53
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App framework flutter/packages/flutter repository. See also f: labels. team Infra upgrades, team productivity, code health, technical debt. See also team: labels. will affect goldens Changes to golden files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants