This repository has been archived by the owner on Apr 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 562
x/evm/keeper: save 24B with Go in-condition variable idiom #828
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## main #828 +/- ##
=======================================
Coverage 57.30% 57.30%
=======================================
Files 73 73
Lines 6029 6029
=======================================
Hits 3455 3455
Misses 2374 2374
Partials 200 200
|
yihuang
approved these changes
Dec 13, 2021
odeke-em
force-pushed
the
evm-keeper-singly-create-To-save-24B
branch
from
December 13, 2021 02:02
392cc3b
to
ae26b42
Compare
odeke-em
force-pushed
the
evm-keeper-singly-create-To-save-24B
branch
2 times, most recently
from
December 13, 2021 19:40
29ed0ad
to
e98d76f
Compare
The prior code doubly invoked (*ethereum/go-ethereum/core/types.Transaction).To() which is quite expensive, and firstly copies 20 bytes each time, then that gets rounded up to the proper size class/pointer alignment so on 64-bit machines 20B -> 24B. Isolating a benchmark for this code per issue #826 shows this saves quite a bit of bytes and some nano seconds which all count up towards the transactions per seconds being processed: ```shell $ benchstat before.txt after.txt name old time/op new time/op delta CopyAddr-8 38.4ns ± 3% 19.3ns ± 3% -49.66% (p=0.000 n=10+10) name old alloc/op new alloc/op delta CopyAddr-8 48.0B ± 0% 24.0B ± 0% -50.00% (p=0.000 n=10+10) name old allocs/op new allocs/op delta CopyAddr-8 2.00 ± 0% 1.00 ± 0% -50.00% (p=0.000 n=10+10) ``` Fixes #826
odeke-em
force-pushed
the
evm-keeper-singly-create-To-save-24B
branch
from
December 13, 2021 22:10
e98d76f
to
e516c3c
Compare
fedekunze
approved these changes
Dec 13, 2021
odeke-em
added a commit
that referenced
this pull request
Dec 14, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The prior code doubly invoked (*ethereum/go-ethereum/core/types.Transaction).To()
which is quite expensive, and firstly copies 20 bytes each time, then
that gets rounded up to the proper size class/pointer alignment so on
64-bit machines 20B -> 24B
Isolating a benchmark for this code per issue #826 shows this saves
quite a bit of bytes and some nano seconds which all count up towards
the transactions per seconds being processed:
Fixes #826