mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-25 17:10:38 +00:00
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:
@@ -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`]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user