Skip to content

CHashWriter that does SHA256 in-place during serialization - #1567

Merged
gavinandresen merged 1 commit into
bitcoin:masterfrom
sipa:chashwriter
Jul 13, 2012
Merged

gavinandresen merged 1 commit into
bitcoin:masterfrom
sipa:chashwriter

Conversation

@sipa

@sipa sipa commented Jul 7, 2012

Copy link
Copy Markdown
Member

SerializeHash used to create a memory-backed CDataStream, serialize the object (almost always a CTransaction) to it, and then feed it to SHA256. As most of the time is actually spent in allocating/deallocating the buffer, it is better to do the SHA256 in-place. That is what CHashWriter does.

On my system, in ultraprune running on a tmpfs-backed datadir, this alone reduces total CPU time spent during import of 185k blocks by 4-5%.

@laanwj

laanwj commented Jul 8, 2012

Copy link
Copy Markdown
Member

Nice! ACK on the code.

May need testcases, though there are currently no testcases for CDataStream with SER_GETHASH at all.

@TheBlueMatt

Copy link
Copy Markdown
Contributor

ACK, though Im interested to see what kind of improvement you see by simply removing duplicated Hash calls.

@jgarzik

jgarzik commented Jul 11, 2012

Copy link
Copy Markdown
Contributor

ACK

1 similar comment
@gavinandresen

Copy link
Copy Markdown
Contributor

ACK

@gavinandresen
gavinandresen merged commit 6ece1d7 into bitcoin:master Jul 13, 2012
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request May 6, 2020
c67fcec [Trivial] Hide CWallet::MultiSend() call in main (random-zebra)
f50918e [RPC] Disable/Hide multisend (random-zebra)
7ac2aee [GUI] Hide MultiSend in the options (random-zebra)

Pull request description:

  Multisend flow is clunky and sorely out of date / in need of a full overhaul and review.
  Let's disable it for now until such time that it can be either re-coded properly, or just dropped entirely.
  We can thus close the following issues for now: bitcoin#1560, bitcoin#1561, bitcoin#1563, bitcoin#1567 .

ACKs for top commit:
  Fuzzbawls:
    ACK c67fcec
  furszy:
    ACK c67fcec

Tree-SHA512: 2719c346c44fc3baaded05c3fe320e59c85e5549e96358873ffb1ce87cd2a89ffb471ac014b737975a3a6a31ced72c4639622b8c8527eabc36564492d367547e
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
@maflcko maflcko removed the CI failed label Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants