summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2023-01-06 12:26:42 +0100
committerNeal H. Walfield <neal@pep.foundation>2023-01-06 12:41:42 +0100
commitc226438e97efcf4cd235a8eb31d3f142d4b2fd06 (patch)
tree1dfca93dbe55612fbf68275f6bcb4506ae07f7cf
parent3e188fb312ad4db1395f5e836bffaf2034b88a42 (diff)
buffered-reader, openpgp: Change the default buffer size.
- Change the default buffer size from 8 KB to 32 KB. - Benchmarking using the chameleon reading a 23 MB cert-d with about 800 certificates, and verifying a signature over a short (2 KB) message, showed that 32 KB is optimal. In particular, 16 KB and 64 KB buffer sizes were, respectively, 10% and 30% worse.
-rw-r--r--buffered-reader/src/lib.rs2
-rw-r--r--openpgp/src/armor.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/buffered-reader/src/lib.rs b/buffered-reader/src/lib.rs
index 57dc6251..5752a508 100644
--- a/buffered-reader/src/lib.rs
+++ b/buffered-reader/src/lib.rs
@@ -288,7 +288,7 @@ lazy_static::lazy_static! {
use std::env::var_os;
use std::str::FromStr;
- let default = 8 * 1024;
+ let default = 32 * 1024;
if let Some(size) = var_os("SEQUOIA_BUFFERED_READER_BUFFER") {
size.to_str()
diff --git a/openpgp/src/armor.rs b/openpgp/src/armor.rs
index 08a16f46..6a3bb381 100644
--- a/openpgp/src/armor.rs
+++ b/openpgp/src/armor.rs
@@ -581,7 +581,7 @@ pub struct Reader<'a> {
assert_send_and_sync!(Reader<'_>);
// The default buffer size.
-const DEFAULT_BUF_SIZE: usize = 8 * 1024;
+const DEFAULT_BUF_SIZE: usize = 32 * 1024;
impl<'a> fmt::Display for Reader<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {