Skip to content

Conversation

JSKitty
Copy link

@JSKitty JSKitty commented Oct 15, 2022

Backports (bitcoin#23819) a simple block hash re-use to save a bunch of CPU cycles in ConnectBlock(), especially useful given X11's computational cost, re-use was applied to Dash-specific ontop of the original commit by jb55.

jb55 and others added 2 commits October 15, 2022 19:17
In the validation:block_connected tracepoint, we call block->GetHash(),
which ends up calling CBlockHeader::GetHash(), executing around 8000
serialization instructions. We don't need to do this extra work, because
block->GetHash() is already called further up in the function. Let's
save that value as a local variable and re-use it in our tracepoint so
there is no unnecessary tracepoint overhead.

Signed-off-by: William Casarin <jb55@jb55.com>
@UdjinM6 UdjinM6 changed the title backport: bitcoin#23819 don't serialize block hash twice backport: partial bitcoin#23819 ConnectBlock: don't serialize block hash twice Oct 15, 2022
@UdjinM6 UdjinM6 added this to the 18.1 milestone Oct 15, 2022
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

Thanks!

LGTM, utACK

Copy link
Collaborator

@kwvg kwvg left a comment

Choose a reason for hiding this comment

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

utACK

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

utACK for squash merge

@PastaPastaPasta PastaPastaPasta merged commit 70717c9 into dashpay:develop Oct 16, 2022
@UdjinM6 UdjinM6 modified the milestones: 18.1, 18.2 Oct 17, 2022
@JSKitty JSKitty deleted the block-hash-optimisation branch November 29, 2024 11:04
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.

5 participants