summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2021-03-23 17:45:02 -0400
committerAndrew Gallant <jamslam@gmail.com>2021-03-23 17:45:02 -0400
commit46fb77c20cc46e61117d68a68bb306cc665c6da6 (patch)
tree588dbe43c9e58d1788e3ccf9127fc4a52e33e9f5
parent6a1c3253e02427d3e7ad6389b624b1a38eae61e1 (diff)
searcher: bump buffer size
This increases the initial buffer size from 8KB to 64KB. This actually leads to a reasonably noticeable improvement in at least one work-load, and is unlikely to regress in any other case. Also, since Rust programs (at least on Linux) seem to always use a minimum of 6-8MB of memory, adding an extra 56KB is negligible. Before: $ hyperfine -i "rg 'zqzqzqzq' OpenSubtitles2018.raw.en --no-mmap" Benchmark #1: rg 'zqzqzqzq' OpenSubtitles2018.raw.en --no-mmap Time (mean ± σ): 2.109 s ± 0.012 s [User: 565.5 ms, System: 1541.6 ms] Range (min … max): 2.094 s … 2.128 s 10 runs After: $ hyperfine -i "rg 'zqzqzqzq' OpenSubtitles2018.raw.en --no-mmap" Benchmark #1: rg 'zqzqzqzq' OpenSubtitles2018.raw.en --no-mmap Time (mean ± σ): 1.802 s ± 0.006 s [User: 462.3 ms, System: 1337.9 ms] Range (min … max): 1.795 s … 1.814 s 10 runs
-rw-r--r--crates/searcher/src/line_buffer.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/searcher/src/line_buffer.rs b/crates/searcher/src/line_buffer.rs
index bd3a273d..d0f2a87a 100644
--- a/crates/searcher/src/line_buffer.rs
+++ b/crates/searcher/src/line_buffer.rs
@@ -4,7 +4,7 @@ use std::io;
use bstr::ByteSlice;
/// The default buffer capacity that we use for the line buffer.
-pub(crate) const DEFAULT_BUFFER_CAPACITY: usize = 8 * (1 << 10); // 8 KB
+pub(crate) const DEFAULT_BUFFER_CAPACITY: usize = 64 * (1 << 10); // 8 KB
/// The behavior of a searcher in the face of long lines and big contexts.
///