Skip to content

Commit 46fb77c

Browse files
committed
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
1 parent 6a1c325 commit 46fb77c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/searcher/src/line_buffer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::io;
44
use bstr::ByteSlice;
55

66
/// The default buffer capacity that we use for the line buffer.
7-
pub(crate) const DEFAULT_BUFFER_CAPACITY: usize = 8 * (1 << 10); // 8 KB
7+
pub(crate) const DEFAULT_BUFFER_CAPACITY: usize = 64 * (1 << 10); // 8 KB
88

99
/// The behavior of a searcher in the face of long lines and big contexts.
1010
///

0 commit comments

Comments
 (0)