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

Parallelize network requests in assets controllers #1801

Merged
merged 5 commits into from
Oct 26, 2023

Conversation

bergeron
Copy link
Contributor

Explanation

Parallelizes network requests in assets controllers for better performance.

I see each non-cached RPC request taking ~50ms on fast internet, and ~500ms on 3g internet. Parallelizing requests where possible causes a noticeable performance improvement. For example, getting details for an ERC-721 NFT in parallel benchmarks ~100ms quicker on fast internet, and ~600ms faster on 3g internet.

Changelog

@metamask/assets-controllers

  • FIXED: Parallelized network requests for better performance

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@bergeron bergeron requested a review from a team as a code owner October 10, 2023 19:29
@BelfordZ
Copy link
Contributor

nice!

@bergeron
Copy link
Contributor Author

I'm looking at the tests failing in CI. But so far they're passing locally.

@sahar-fehri
Copy link
Contributor

🚀

sahar-fehri
sahar-fehri previously approved these changes Oct 24, 2023
salimtb
salimtb previously approved these changes Oct 24, 2023
adonesky1
adonesky1 previously approved these changes Oct 25, 2023
Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

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

LGTM

@bergeron bergeron dismissed stale reviews from adonesky1, salimtb, and sahar-fehri via 18d4131 October 25, 2023 21:24
@bergeron
Copy link
Contributor Author

bergeron commented Oct 25, 2023

Some NFT tests (the updateNftFavoriteStatus suite) were timing out in Node 16.x. Increasing their timeouts worked, but instead I'm going to make them faster by mocking metadata instead of fetching it for real.

@bergeron bergeron requested a review from jiexi October 25, 2023 23:30
@bergeron bergeron merged commit a8da1c4 into main Oct 26, 2023
115 checks passed
@bergeron bergeron deleted the brian/parallelize-assets-controller-requests branch October 26, 2023 14:27
mcmire pushed a commit that referenced this pull request Nov 2, 2023
## Explanation

Parallelizes network requests in assets controllers for better
performance.

I see each non-cached RPC request taking ~50ms on fast internet, and
~500ms on 3g internet. Parallelizing requests where possible causes a
noticeable performance improvement. For example, getting details for an
ERC-721 NFT in parallel benchmarks ~100ms quicker on fast internet, and
~600ms faster on 3g internet.

## Changelog

### `@metamask/assets-controllers`

- **FIXED**: Parallelized network requests for better performance

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've highlighted breaking changes using the "BREAKING" category
above as appropriate

---------

Co-authored-by: Alex Donesky <adonesky@gmail.com>
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.

5 participants