Skip to content

Commit 71c06fe

Browse files
authored
chore: Use smaller merge buffers. (#74)
## What Reduce the per-segment buffer sizes from 4MB to 512KB. ## Why #71 moved from buffers which covered the entire file to maximum 4MB buffers. But for merges with very large segment counts, we need to be using more conservative buffer sizes. 512KB will still eliminate most posting list reads: posting lists larger than 512KB will skip the buffer.
1 parent 5f3f29f commit 71c06fe

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

common/src/buffered_file_slice.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ use std::ops::Range;
66
use super::file_slice::FileSlice;
77
use super::{HasLen, OwnedBytes};
88

9-
const DEFAULT_BUFFER_MAX_SIZE: usize = 4 * 1024 * 1024; // 4 MB
9+
const DEFAULT_BUFFER_MAX_SIZE: usize = 512 * 1024; // 512K
1010

1111
/// A buffered reader for a FileSlice.
1212
///
1313
/// Reads the underlying `FileSlice` in large, sequential chunks to amortize
1414
/// the cost of `read_bytes` calls, while keeping peak memory usage under control.
1515
///
1616
/// TODO: Rather than wrapping a `FileSlice` in buffering, it will usually be better to adjust a
17-
/// `FileHandle` to directly handle buffering itself (as that allows separate `FileSlice`s read
18-
/// from the same `FileHandle` to share buffers.)
17+
/// `FileHandle` to directly handle buffering itself.
18+
/// TODO: See: https://github.com/paradedb/paradedb/issues/3374
1919
pub struct BufferedFileSlice {
2020
file_slice: FileSlice,
2121
buffer: RefCell<OwnedBytes>,

0 commit comments

Comments
 (0)