Speedup jid parsing

name        control ns/iter  variable ns/iter  diff ns/iter   diff %  speedup
big_jids    638              456                       -182  -28.53%   x 1.40
small_jids  92               91                          -1   -1.09%   x 1.01
This commit is contained in:
Bastien Orivel 2017-06-12 23:11:37 +02:00
parent 1f11796057
commit e00cfa2c2e

View file

@ -76,7 +76,7 @@ impl FromStr for Jid {
fn from_str(s: &str) -> Result<Jid, JidParseError> { fn from_str(s: &str) -> Result<Jid, JidParseError> {
// TODO: very naive, may need to do it differently // TODO: very naive, may need to do it differently
let iter = s.chars(); let iter = s.chars();
let mut buf = String::new(); let mut buf = String::with_capacity(s.len());
let mut state = ParserState::Node; let mut state = ParserState::Node;
let mut node = None; let mut node = None;
let mut domain = None; let mut domain = None;