mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-01 16:53:52 +02:00
Merge bitcoin/bitcoin#19690: util: improve FindByte() performance
72efc26439util: improve streams.h:FindByte() performance (Larry Ruane)604df63f6c[bench] add streams findbyte (gzhao408) Pull request description: This PR is strictly a performance improvement; there is no functional change. The `CBufferedFile::FindByte()` method searches for the next occurrence of the given byte in the file. Currently, this is done by explicitly inspecting each byte in turn. This PR takes advantage of `std::find()` to do the same more efficiently, improving its CPU runtime by a factor of about 25 in typical use. ACKs for top commit: achow101: re-ACK72efc26439stickies-v: re-ACK72efc26439Tree-SHA512: ddf0bff335cc8aa34f911aa4e0558fa77ce35d963d602e4ab1c63090b4a386faf074548daf06ee829c7f2c760d06eed0125cf4c34e981c6129cea1804eb3b719
This commit is contained in:
@@ -53,7 +53,7 @@ FUZZ_TARGET(buffered_file)
|
||||
return;
|
||||
}
|
||||
try {
|
||||
opt_buffered_file->FindByte(fuzzed_data_provider.ConsumeIntegral<uint8_t>());
|
||||
opt_buffered_file->FindByte(std::byte(fuzzed_data_provider.ConsumeIntegral<uint8_t>()));
|
||||
} catch (const std::ios_base::failure&) {
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user