preallocate

This commit is contained in:
mehbark 2024-11-28 17:01:18 -05:00
parent 1461382de8
commit 134d82a08b

View file

@ -14,7 +14,9 @@ fn main() {
args.next().unwrap();
let min_syllables: usize = args.next().expect("one arg").parse().expect("a number");
let mut message = String::with_capacity(128);
// the vast, vast majority of discord messages are under 2000 chars, so this avoids
// reallocating
let mut message = String::with_capacity(2048);
io::stdin()
.read_to_string(&mut message)
.expect("i want a message");