perf(replay/recorder): reduce SmallVec size to 64
This commit is contained in:
parent
15cd2e673e
commit
d8ac556884
@ -66,7 +66,6 @@ impl Recorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn save_raw_packet(&mut self, raw_packet: &[u8]) -> Result<()> {
|
pub fn save_raw_packet(&mut self, raw_packet: &[u8]) -> Result<()> {
|
||||||
println!("{}", raw_packet.len());
|
|
||||||
let mut data = Vec::with_capacity(raw_packet.len() + 8);
|
let mut data = Vec::with_capacity(raw_packet.len() + 8);
|
||||||
data.extend(&TryInto::<u32>::try_into(self.start.elapsed().as_millis())?.to_be_bytes());
|
data.extend(&TryInto::<u32>::try_into(self.start.elapsed().as_millis())?.to_be_bytes());
|
||||||
data.extend(&TryInto::<u32>::try_into(raw_packet.len())?.to_be_bytes());
|
data.extend(&TryInto::<u32>::try_into(raw_packet.len())?.to_be_bytes());
|
||||||
@ -76,7 +75,7 @@ impl Recorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn save_packet<T: ProtocolPacket>(&mut self, packet: &T) -> Result<()> {
|
pub fn save_packet<T: ProtocolPacket>(&mut self, packet: &T) -> Result<()> {
|
||||||
let mut raw_packet = SmallVec::<[u8; 256]>::new();
|
let mut raw_packet = SmallVec::<[u8; 64]>::new();
|
||||||
packet.id().azalea_write_var(&mut raw_packet)?;
|
packet.id().azalea_write_var(&mut raw_packet)?;
|
||||||
packet.write(&mut raw_packet)?;
|
packet.write(&mut raw_packet)?;
|
||||||
self.save_raw_packet(&raw_packet)
|
self.save_raw_packet(&raw_packet)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user