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.
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.
ACK. (I tested this on the above mentioned other branch.)
Seems straightforward - code review ACK https://github.com/bitcoin/bitcoin/pull/9346/commits/ed5896976a5cb6d893babedec2bc88cb7a251033
73 |
74 | - CDataStream ssValue(SER_DISK, CLIENT_VERSION);
75 | ssValue.reserve(DBWRAPPER_PREALLOC_VALUE_SIZE);
76 | ssValue << value;
77 | ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent));
78 | leveldb::Slice slValue(&ssValue[0], ssValue.size());
CDataStream should really get a .data(). Not necessarily here though :)
Agree, but let's do that separately (#9353?).