Skip to content

feat: add precompile cache for execution #15536

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

Merged
merged 43 commits into from
Apr 16, 2025
Merged

Conversation

Rjected
Copy link
Member

@Rjected Rjected commented Apr 4, 2025

Closes #13984

@jenpaff jenpaff added the C-perf A change motivated by improving speed, memory usage or disk footprint label Apr 8, 2025
@jenpaff jenpaff assigned shekhirin and fgimenez and unassigned Rjected and shekhirin Apr 8, 2025
@fgimenez fgimenez moved this from Todo to In Progress in Reth Tracker Apr 9, 2025
@fgimenez fgimenez force-pushed the dan/execution-precompile-cache branch from 93f2f29 to 24a6c4e Compare April 9, 2025 08:00
@fgimenez fgimenez changed the title wip: add precompile cache for execution feat: add precompile cache for execution Apr 9, 2025
Copy link

codspeed-hq bot commented Apr 9, 2025

CodSpeed Performance Report

Merging #15536 will not alter performance

Comparing dan/execution-precompile-cache (a95a58f) with main (a11d127)

Summary

✅ 77 untouched benchmarks

@fgimenez fgimenez force-pushed the dan/execution-precompile-cache branch from 24a6c4e to eba460e Compare April 9, 2025 08:44
@jenpaff jenpaff linked an issue Apr 9, 2025 that may be closed by this pull request
@fgimenez fgimenez force-pushed the dan/execution-precompile-cache branch 3 times, most recently from 953907e to cbafb50 Compare April 11, 2025 09:22
@fgimenez fgimenez marked this pull request as ready for review April 11, 2025 11:12
@fgimenez fgimenez moved this from In Progress to In Review in Reth Tracker Apr 11, 2025
@jenpaff jenpaff requested a review from shekhirin April 11, 2025 12:43
@fgimenez fgimenez force-pushed the dan/execution-precompile-cache branch from 9552e8e to ef9cf9b Compare April 14, 2025 09:36
Copy link
Collaborator

@shekhirin shekhirin left a comment

Choose a reason for hiding this comment

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

I don't see any logical errors, LGTM! I think this works.

Would be nice to get rid of std feature propagated everywhere, but not sure how to better approach it.

@fgimenez fgimenez force-pushed the dan/execution-precompile-cache branch from c936218 to d1deb8e Compare April 15, 2025 15:36
@jenpaff jenpaff moved this from In Progress to In Review in Reth Tracker Apr 15, 2025
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

last nit

Comment on lines +156 to +159
let key =
PrecompileKey { address: *address, spec: self.spec, input: inputs.input.clone() };

let cache_result = cache.cache.get(&key);
Copy link
Collaborator

Choose a reason for hiding this comment

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

we can avoid his because this is relatively large overhead per call

this is how the underlying precompiles does it:

        let Some(precompile) = self.precompiles.get(address) else {
            return Ok(None);
        };

which is just .contains

so what we should do here is short-circuit if the precompiles don't contain the address

@github-project-automation github-project-automation bot moved this from In Review to In Progress in Reth Tracker Apr 16, 2025
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

I find the cache handling still a bit weird, because a bit confusing but for now this seems okay

@fgimenez fgimenez added this pull request to the merge queue Apr 16, 2025
Merged via the queue into main with commit df8acc5 Apr 16, 2025
43 checks passed
@fgimenez fgimenez deleted the dan/execution-precompile-cache branch April 16, 2025 09:43
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Apr 16, 2025
@rkrasiuk rkrasiuk restored the dan/execution-precompile-cache branch April 17, 2025 16:06
rkrasiuk added a commit that referenced this pull request Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-perf A change motivated by improving speed, memory usage or disk footprint
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Precompile Caching
6 participants