-
Notifications
You must be signed in to change notification settings - Fork 778
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
EVM optimizations #2405
EVM optimizations #2405
Conversation
Codecov Report
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. |
this._store = Buffer.concat([ | ||
this._store, | ||
Buffer.alloc(Math.ceil(sizeDiff / CONTAINER_SIZE) * CONTAINER_SIZE), | ||
]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, just did a quick search ._store.length
for the EVM to see if there are any external accesses to memory length where we would have side effects, but this seems not to be the case (apart from some memory-internal tests which can eventually be adopted if needed). 🙂
So this seems like a really clever solution to reduce the buffer allocations drastically along memory extensions! 👍
(still am a bit cautious and wonder though if this might have some side effect(s) somewhere? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that we should very carefully examine this. (I also did the same search as you did since I was afraid that there indeed might be external reads to it)
@jochem-brouwer for speed benchmarks you could try to plug in https://github.com/ipsilon/evm-benchmarks (it uses the general state tests format). If you do please let us know the results (or just tag me in the issue/PR). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Congrats, your important contribution to this open-source project has earned you a GitPOAP! GitPOAP: 2022 EthereumJS Contributor: Head to gitpoap.io & connect your GitHub account to mint! Learn more about GitPOAPs here. |
This PR is aimed towards optimizing EVM. In particular, see: NomicFoundation/hardhat#3316 (comment)
When updating the EVM using chunk-sized extensions (so do not extend it with 32 bytes each time, but instead of containers of 8192 / 8 kb), MSTORE gets about 8 times faster (based upon above problem ^). It also almost halves the runtime of aboves' problem.
Still WIP because I might want to introduce more optimizations (plus this might cause a bunch of test errors).