-
Notifications
You must be signed in to change notification settings - Fork 20.4k
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
miner: initialize maps with known size #27228
Conversation
miner/worker.go
Outdated
@@ -121,7 +121,7 @@ func (env *environment) copy() *environment { | |||
// to do the expensive deep copy for them. | |||
cpy.txs = make([]*types.Transaction, len(env.txs)) | |||
copy(cpy.txs, env.txs) | |||
cpy.uncles = make(map[common.Hash]*types.Header) | |||
cpy.uncles = make(map[common.Hash]*types.Header, len(env.uncles)) |
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.
This change conflicts with https://github.com/ethereum/go-ethereum/pull/27218/files#diff-689874b30f6f905ce6c47cdefeddcf052b467a7936a981f4b6cf38939e10d924L124, where @rjl493456442 removes it. Let's revert this change and leave it be as is, it won't be present for much longer anyway
miner/payload_building_test.go
Outdated
@@ -82,7 +82,7 @@ func TestBuildPayload(t *testing.T) { | |||
} | |||
|
|||
func TestPayloadId(t *testing.T) { | |||
ids := make(map[string]int) | |||
ids := make(map[string]int, 7) |
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.
IMO micro-optimizations inside tests isn't worth it. I'd rather not touch it personally
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.
LGTM, thanks!
* miner : initialize maps with known size * miner:some reverts
* miner : initialize maps with known size * miner:some reverts
This reverts commit 182fc72.
This reverts commit 182fc72.
No description provided.