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

fix: multicall perfomance #1081

Merged
merged 3 commits into from
Aug 29, 2023
Merged

fix: multicall perfomance #1081

merged 3 commits into from
Aug 29, 2023

Conversation

witem
Copy link
Contributor

@witem witem commented Aug 29, 2023

It looks like viem has big performance degradation because of calling chunkedCalls.flat() for each item from results in the multicall function. Based on the code I think we can move this flat out of the map cycle, which will significantly improve performance, especially for big multicalls.

Test scenario around 2k balanceOf with batchSize: 30 * 1024:
Flame chart before:
image
Flame chart after:
image


PR-Codex overview

This PR focuses on improving multicall performance.

Detailed summary

  • Refactored code to remove redundant variable declaration.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@vercel
Copy link

vercel bot commented Aug 29, 2023

@witem is attempting to deploy a commit to the wagmi Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot
Copy link

changeset-bot bot commented Aug 29, 2023

🦋 Changeset detected

Latest commit: 295335b

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Aug 29, 2023

Codecov Report

Merging #1081 (d2d4870) into main (cf4d5d8) will decrease coverage by 12.45%.
The diff coverage is 0.00%.

@@             Coverage Diff             @@
##             main    #1081       +/-   ##
===========================================
- Coverage   99.86%   87.41%   -12.45%     
===========================================
  Files         403      386       -17     
  Lines       31111    30326      -785     
  Branches     2175     1407      -768     
===========================================
- Hits        31068    26510     -4558     
- Misses         38     3788     +3750     
- Partials        5       28       +23     
Files Changed Coverage Δ
src/actions/public/multicall.ts 37.50% <0.00%> (-62.50%) ⬇️

... and 142 files with indirect coverage changes

.changeset/pink-beers-share.md Outdated Show resolved Hide resolved
@jxom jxom merged commit 29ba250 into wevm:main Aug 29, 2023
1 check passed
@github-actions github-actions bot mentioned this pull request Aug 29, 2023
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.

3 participants