-
- Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
- It currently pushes one char at a time. It should chunk to amortize allocations.
Current code is similar to
let mut buf = String::new(); loop { // xxx buf.push(c); }Obviously, this almost always allocate and reallocates quite frequently.
- It allocate needlessly while tokenizing numeric literals.
Noticeable parts are
let s = format!("{}", val); // if it contains '8' or '9', it's decimal. if s.contains('8') || s.contains('9') {}// It's Legacy octal, and we should reinterpret value. let val = u64::from_str_radix(&format!("{}", val), 8) .expect("Does this can really happen?"); let val = format!("{}", val) .parse() .expect("failed to parse numeric value as f64");val = format!("{}.{}", val, minority).parse();