Skip to content

Conversation

@sipa
Copy link
Member

@sipa sipa commented Dec 14, 2016

Reuse the serialization buffers used for constructing the LevelDB write batch. This avoids 2 allocations per utxo write.

I have not benchmarked this exact change, but in another branch I'm working on it results in a 12% speedup for the flush.

Reuse the serialization buffers used for constructing the LevelDB
write batch. This avoids 2 allocations per utxo write.
@gmaxwell
Copy link
Contributor

ACK. (I tested this on the above mentioned other branch.)

@laanwj
Copy link
Member

laanwj commented Dec 14, 2016

Seems straightforward - code review ACK ed58969

ssValue.reserve(DBWRAPPER_PREALLOC_VALUE_SIZE);
ssValue << value;
ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent));
leveldb::Slice slValue(&ssValue[0], ssValue.size());
Copy link
Member

Choose a reason for hiding this comment

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

CDataStream should really get a .data(). Not necessarily here though :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree, but let's do that separately (#9353?).

@paveljanik
Copy link
Contributor

ACK ed58969

@sipa sipa merged commit ed58969 into bitcoin:master Dec 16, 2016
sipa added a commit that referenced this pull request Dec 16, 2016
ed58969 Batch construct batches (Pieter Wuille)
codablock pushed a commit to codablock/dash that referenced this pull request Oct 23, 2017
ed58969 Batch construct batches (Pieter Wuille)
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants