Set `StackVec` stack size to 2KB (from 4KB).

Fortune for rsh's current commit: Small blessing − 小吉
complex-cap
Avril 3 years ago
parent 37a00d1099
commit cf71fe20ab
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -5,7 +5,7 @@ use std::iter;
use smallvec::SmallVec;
/// Max size of memory allowed to be allocated on the stack.
pub const STACK_MEM_ALLOC_MAX: usize = 4096;
pub const STACK_MEM_ALLOC_MAX: usize = 2048; // 2KB
/// A stack-allocated vector that spills onto the heap when needed.
pub type StackVec<T> = SmallVec<[T; STACK_MEM_ALLOC_MAX]>;

@ -12,9 +12,9 @@ where S: MessageSender,
println!(">> Created message: {:?}", message);
let serialised = message.serialise(s).expect("Failed to serialise message");
println!(">> Serialised message: {:?}", serialised);
let binary = serialised.into_bytes();
let binary = serialised.into_bytes().expect("Failed to serialize to bytes");
println!(">> Written to {} bytes", binary.len());
let read = SerializedMessage::from_bytes(&binary).expect("Failed to read serialised message from binary");
let read = SerializedMessage::from_bytes(binary).expect("Failed to read serialised message from binary");
println!(">> Read from bytes: {:?}", read);
let deserialised = Message::deserialize(&read, d).expect("Failed to deserialise message");
println!(">> Deserialised message: {:?}", deserialised);

Loading…
Cancel
Save