-
Notifications
You must be signed in to change notification settings - Fork 965
perf: refactor interpreter internals #558
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
Conversation
2dd9e0c to
3658fa7
Compare
DaniPopes
left a comment
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.
General changes:
- restrict visibility of items that are not exported to emphasize that they are private
- omit error from
as_usize_or_fail!macro calls when it's the default (InvalidOperandOOG) - rewrote benches from
revm-testto criterion, and moved them tocrates/revm/benches/
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.
Changes:
- cmp opcodes are now branchless
byteindexes into the slice instead of performing shiftssarusesU256::MAXinstead of computing it at runtime
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.
Changes:
Displayshould not be gated tostd- avoid using manual implementations (like swap and pop) where possible by deferring to the standard library. This produces the same instructions while being safer
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.
Changes:
- declare opcode constants, names (
OPCODE_JUMPMAP) and theevalfunction in one macro call
66c08a0 to
c771cc1
Compare
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.
Changes:
- change
is_none()+unwrapto uselet else
1a0b3d3 to
b937b87
Compare
b937b87 to
d70c87b
Compare
`push_b256!` will convert the big-endian `[u8; 32]` to the U256 `[u64; 4]` at runtime, so use `push!` to avoid doing that where possible.
f6f3fba to
d89e56d
Compare
d89e56d to
c657758
Compare
4f5e0ba to
2a06916
Compare
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.
@DaniPopes you made too many changes here to be accepted as it is, and I don't agree with some of them
2a06916 to
c536272
Compare
|
@rakita Sure makes sense, what do you want me to split off / change? |
This PR focuses on refactoring some parts of the interpreter which lead to, although minor, performance gains.
Closes #310, not fixes, as the current
matchperforms better on debug builds, and performs the same in release builds. This is not shown in the results.Results
Cachegrind
See #582
Benches
Not entirely sure why the non-generic version performs better, since I would expect the checks to be optimized out at compile time on the generic version.I have included the patch which can be used to change between the two versions.Time benches shouldn't be relied upon for these type of small changes, and these ones are also outdated.
Main
36de35b
Generic (patch)
3658fa7
Patch
Non generic
3658fa7