mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-09 20:23:35 +01:00
Merge bitcoin/bitcoin#30884: streams: cache file position within AutoFile
a240e150e8streams: remove AutoFile::Get() entirely (Pieter Wuille)e624a9bef1streams: cache file position within AutoFile (Pieter Wuille) Pull request description: Fixes #30833. Instead of relying on frequent `ftell` calls (which appear to cause a significant slowdown on some systems) in XOR-enabled `AutoFile`s, cache the file position within `AutoFile` itself. ACKs for top commit: achow101: ACKa240e150e8davidgumberg: untested reACKa240e150e8theStack: Code-review ACKa240e150e8Tree-SHA512: fd3681edc018afaf955dc7a41a0c953ca80d46c1129e3c5b306c87c95aae93b2fe7b900794eb8b6f10491f9211645e7939918a28838295e6873eb226fca7006f
This commit is contained in:
@@ -19,7 +19,7 @@ static void FindByte(benchmark::Bench& bench)
|
||||
uint8_t data[file_size] = {0};
|
||||
data[file_size-1] = 1;
|
||||
file << data;
|
||||
std::rewind(file.Get());
|
||||
file.seek(0, SEEK_SET);
|
||||
BufferedFile bf{file, /*nBufSize=*/file_size + 1, /*nRewindIn=*/file_size};
|
||||
|
||||
bench.run([&] {
|
||||
|
||||
Reference in New Issue
Block a user