Skip to content

Speedup fetching of token balances in Swap #28634

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

Closed
onyb opened this issue Feb 21, 2023 · 1 comment · Fixed by brave/brave-core#17371
Closed

Speedup fetching of token balances in Swap #28634

onyb opened this issue Feb 21, 2023 · 1 comment · Fixed by brave/brave-core#17371

Comments

@onyb
Copy link
Member

onyb commented Feb 21, 2023

Currently Swap suffers from a performance issue that's unique to it since we fetch balances for the entire tokens list, instead of just the visible assets list. This results in hundreds of mojo calls, which we can potentially cut down to a single one using the new GetERC20TokenBalances mojo method.

We can expect a speedup of 3x-10x, depending on the size of the tokens list. Following this improvement, we can also periodically refresh the balances without incurring a heavy cost.

@srirambv
Copy link
Contributor

Verification passed on

Brave 1.51.97 Chromium: 112.0.5615.138 (Official Build) beta (64-bit)
Revision 2258f2fcaeb07bc95c992b7ca47f0b43ead9865c-refs/branch-heads/5615@{#1282}
OS Windows 11 Version 22H2 (Build 22621.1344)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants