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

core, trie: cache the code chunking in contract #123

Closed
wants to merge 5 commits into from

Conversation

gballet
Copy link
Owner

@gballet gballet commented Aug 11, 2022

Since ChunkifyCode and touchEachChunksOnReadAndChargeGas are dominating the execution time, this PR attempts to cache the values as much as possible, in order to reduce the amount of time these functions are called.

@gballet
Copy link
Owner Author

gballet commented Aug 11, 2022

Before: ChunkifyCode dominates execution time

profile003

Current state: execution sped up by; a factor 2, and touchEachChunksOnReadAndChargeGas now dominates
profile004

Both functions were called too often, because chunking is performed in PUSHn instructions, which are among the most common instructions found in a standard EVM bytecode.

…als (#122)

* core: cache code chunk evaluations to reduce the amount of address evals

* fix init bug

* fix slicing error that was introduced in previous commits
@gballet
Copy link
Owner Author

gballet commented Aug 12, 2022

profile006

Confirmed improvement

@gballet gballet marked this pull request as ready for review August 12, 2022 09:41
@gballet gballet requested a review from holiman as a code owner August 12, 2022 09:41
@gballet
Copy link
Owner Author

gballet commented Aug 29, 2024

This is still useful when calling CODECOPY, but contract execution is no longer a problem and EXTCODECOPY won't work. I think a better approach is to create a global code cache. I'm creating an issue for that.

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.

1 participant