diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2021-11-04 10:15:11 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2021-11-04 10:29:39 +0100 |
commit | 62be3957d51efb2191b56c97c732583d02caf1ae (patch) | |
tree | a7866bc027d03bd757f6668d1c66287bcfbb45e0 /Cargo.lock | |
parent | 11e408c7b7b644f5b94af06dd54598d1f8ff58fc (diff) |
openpgp: Improve the streaming Decryptor's buffer strategy.
- Previously, for a read of X bytes, we'd request X + buffer_size
from the underlying buffered reader, then satisfy the read
request, after which we'd request the next X + buffer_size bytes
for the next read. This requires the underlying reader to copy
buffer_size bytes for each read. In a typical scenario, we'd copy
25 megabytes (the default buffer size) for every 8 kilobytes
read (std::io::copy's default buffer size). This incurs a linear
cost with a very high factor.
- Improve this by requesting 2 * buffer_size, then satisfying the
reads from the first half of that buffer, only consuming the first
half once we have exhausted the first half. Then, we'd request
the next 2 * buffer_size, at which point the underlying buffered
reader has to copy the data to a new buffer.
- See #771.
Diffstat (limited to 'Cargo.lock')
0 files changed, 0 insertions, 0 deletions