From b0f00f4d877b5a719550e0a9bd2faca753704b06 Mon Sep 17 00:00:00 2001 From: Sander Hautvast Date: Fri, 28 Oct 2022 20:53:44 +0200 Subject: [PATCH] no reallocation --- src/record.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/record.rs b/src/record.rs index 56fdc12..ce47b05 100644 --- a/src/record.rs +++ b/src/record.rs @@ -34,8 +34,7 @@ impl Into> for Record{ let mut length_bytes = varint::write(record_length as u64); let mut rowid_bytes = varint::write(self.rowid); - // let mut buffer = Vec::with_capacity(length_bytes.len() + rowid_bytes.len() + record_length); - let mut buffer = Vec::new(); + let mut buffer = Vec::with_capacity(length_bytes.len() + rowid_bytes.len() + record_length as usize); buffer.append(&mut length_bytes); buffer.append(&mut rowid_bytes);