-
Notifications
You must be signed in to change notification settings - Fork 20.5k
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
core: speed up header import #21967
core: speed up header import #21967
Conversation
3ba14c9
to
90be6be
Compare
@@ -180,10 +181,7 @@ func (ethash *Ethash) verifyHeaderWorker(chain consensus.ChainHeaderReader, head | |||
if parent == nil { | |||
return consensus.ErrUnknownAncestor | |||
} | |||
if chain.GetHeader(headers[index].Hash(), headers[index].Number.Uint64()) != nil { |
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.
Why remove this check ?
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.
b5aa900
to
6bce7c4
Compare
consensus/ethash/consensus.go
Outdated
@@ -130,11 +130,12 @@ func (ethash *Ethash) VerifyHeaders(chain consensus.ChainHeaderReader, headers [ | |||
done = make(chan int, workers) | |||
errors = make([]error, len(headers)) | |||
abort = make(chan struct{}) | |||
utcNow = time.Now().Unix() |
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.
unix :)
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.
Pls fix utx->unix, othewise SGTM
d06d950
to
92a53c9
Compare
This is a follow up to #21471.
Charts and niceties can be found here: https://github.com/holiman/headerimport/blob/main/README.md
This PR implements the following modifications
Now
time.Now
for every single headerTLDR: With these changes, writing 1M headers goes down to
62s
for 1M headers, from106s
on (old) master, and80s
on PR 21471.