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

perf(interpreter): keep track of remaining gas rather than spent #1221

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

DaniPopes
Copy link
Collaborator

@DaniPopes DaniPopes commented Mar 24, 2024

Removes a load and a comparison in the very hot record_cost function (see diff below) by using overflowing_sub instead of saturating_add + < limit.

Reduces snailtracer instructions from 2,768,629,456 to 2,661,673,460 (-3.86%).

I've also renamed Gas::spend to Gas::spent (with a deprecation warning).

image

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 think tracking remaining gas is more intuitive.

afict this merely flips cost recording logic

Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

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

This is cool! We dont need to compare it with gas.limit anymore

@rakita rakita merged commit 61f8771 into bluealloy:main Mar 25, 2024
25 checks passed
This was referenced Mar 25, 2024
@DaniPopes DaniPopes deleted the invert-gas-conditions branch March 25, 2024 11:20
@github-actions github-actions bot mentioned this pull request Mar 26, 2024
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