WIP: try to eliminate the raw_vec::finish_grow and bytes::promotable_even-drop

This one doesn't make a big difference.
This commit is contained in:
Christian Schwarz
2024-01-29 19:52:05 +00:00
parent 28a4247c97
commit 0e3561f6d1
3 changed files with 4 additions and 3 deletions

View File

@@ -65,6 +65,7 @@ where
pub struct ValueReconstructState {
pub records: Vec<(Lsn, NeonWalRecord)>,
pub img: Option<(Lsn, Bytes)>,
pub(crate) scratch: Vec<u8>,
}
/// Return value from [`Layer::get_value_reconstruct_data`]

View File

@@ -778,15 +778,14 @@ impl DeltaLayerInner {
// Ok, 'offsets' now contains the offsets of all the entries we need to read
let cursor = file.block_cursor();
let mut buf = Vec::new();
for (entry_lsn, pos) in offsets {
cursor
.read_blob_into_buf(pos, &mut buf, ctx)
.read_blob_into_buf(pos, &mut reconstruct_state.scratch, ctx)
.await
.with_context(|| {
format!("Failed to read blob from virtual file {}", file.file.path)
})?;
let val = Value::des(&buf).with_context(|| {
let val = Value::des(&reconstruct_state.scratch).with_context(|| {
format!(
"Failed to deserialize file blob from virtual file {}",
file.file.path

View File

@@ -601,6 +601,7 @@ impl Timeline {
let mut reconstruct_state = ValueReconstructState {
records: Vec::new(),
img: None,
scratch: Vec::with_capacity(2 * 8192), // for good measure
};
let timer = crate::metrics::GET_RECONSTRUCT_DATA_TIME.start_timer();