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

miner: initialize maps with known size #27228

Merged
merged 2 commits into from
May 9, 2023
Merged

Conversation

ucwong
Copy link
Contributor

@ucwong ucwong commented May 8, 2023

No description provided.

@holiman holiman changed the title miner : initialize maps with known size miner: initialize maps with known size May 8, 2023
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))
Copy link
Contributor

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

@@ -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)
Copy link
Contributor

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

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@holiman holiman added this to the 1.11.7 milestone May 9, 2023
@holiman holiman merged commit c798507 into ethereum:master May 9, 2023
shekhirin pushed a commit to shekhirin/go-ethereum that referenced this pull request Jun 6, 2023
* miner : initialize maps with known size

* miner:some reverts
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
* miner : initialize maps with known size

* miner:some reverts
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
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.

2 participants