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

perf: minimise asset data size #8423

Merged
merged 58 commits into from
Jan 7, 2025
Merged

perf: minimise asset data size #8423

merged 58 commits into from
Jan 7, 2025

Conversation

woodenfurniture
Copy link
Member

@woodenfurniture woodenfurniture commented Dec 20, 2024

Description

Reduces bundle size by reducing the size occupied by our generated asset data, to effectively mitigate our bundle size being right on the cloudflare limit (See #7768)

  • Minimizes the size of generatedAssetData.json by a factor of 3x.
  • Minimizes the size of relatedAssetIndex.json by a factor of 51x.
  • Adds singleton for asset service to minimize compute overhead on app boot.
  • Pre-sorts asset list to decouple fetching market cap data from sorting the list of assets (no the primary goal, but nice to have)

TODO:

  • Fix stale relatedAssetKey issue upstream (fix: dont use missing/stale related asset data when generating the related asset index #8424)
  • Encode relatedAssetIndex using the encoded assetIds
  • Consume encoded asset data in app
  • Consume sortedAssetIds in redux
  • (once approved) Delete full dataset unit tests for generated asset data and related asset index
  • Test generating asset data from scratch
  • (once approved) Delete relatedAssetIndex.json and generatedAsssetData.json before merge
  • (once approved) Delete generate:encode-asset-data script and associated files
  • Remove LEGACY_ASSET_DATA_PATH and LEGACY_RELATED_ASSET_INDEX_PATH

Updating branch

git merge develop
yarn
yarn build:packages
yarn generate:encode-asset-data

Issue (if applicable)

closes #8188
closes #8047

Risk

High Risk PRs Require 2 approvals

High risk. Makes extensive changes to asset data generation and consumption.

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

None.

Testing

Should be no change compared to production.

Engineering

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

Screenshots (if applicable)

@woodenfurniture woodenfurniture changed the base branch from develop to related-asset-fix December 20, 2024 04:42
Base automatically changed from related-asset-fix to develop December 20, 2024 05:47
Copy link
Contributor

@gomesalexandre gomesalexandre left a comment

Choose a reason for hiding this comment

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

Absolute beast of a PR ser. See runtime testing below. A few non/blocking comments to tackle at your convenience but overall: hell yeah.

Tested locally:

  • yarn && yarn build:packages && yarn && yarn generate:encode-asset-data is happy and codegen looks good ✅
image
  • App smoke test looks good after full cache nuke ✅

https://jam.dev/c/71520bff-f1e7-4eab-80f7-845fa042ef24

  • Chain selection looks good ✅

https://jam.dev/c/1d5f58eb-4347-4939-abc9-c2dc90f86b7a

@woodenfurniture woodenfurniture enabled auto-merge (squash) January 7, 2025 01:09
@woodenfurniture woodenfurniture merged commit 531fdab into develop Jan 7, 2025
3 checks passed
@woodenfurniture woodenfurniture deleted the asset-list-sorting branch January 7, 2025 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

benchmark asset market cap queries and sorts Serve asset data from CDN
3 participants