no reallocation

This commit is contained in:
Sander Hautvast 2022-10-28 20:53:44 +02:00
parent e731bbd0fb
commit b0f00f4d87

View file

@ -34,8 +34,7 @@ impl Into<Vec<u8>> 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);