-
Notifications
You must be signed in to change notification settings - Fork 50
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
Query evmc_tx_context once in each execution #393
Conversation
@@ -67,6 +67,9 @@ class EthereumInterface { | |||
// set sane defaults | |||
m_result.returnValue = std::vector<uint8_t>{}; | |||
m_result.isRevert = false; | |||
|
|||
// cache the transaction context here | |||
m_context->fn_table->get_tx_context(&m_tx_context, m_context); |
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.
perhaps lazily populate this (upon first call by the EEI) and store it as a pair<bool, tx_context>
that gets checked on each EEI call using it?
It would be a bit of a micro-optimization but contracts that do not need the tx_context don't need to call EVMC for it.
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.
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.
@axic on the topic of obsessive micro-optimization, a branch comparing a u8 (bool) is only really a tradeoff towards code size rather than performance
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'm not considering to change the EVMC at the moment.
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.
Created issue: ethereum/evmc#120
Codecov Report
@@ Coverage Diff @@
## master #393 +/- ##
==========================================
- Coverage 67.66% 67.47% -0.19%
==========================================
Files 8 8
Lines 1036 1030 -6
Branches 135 135
==========================================
- Hits 701 695 -6
Misses 303 303
Partials 32 32 |
Also independently discovered by @jakelang.