3 ms·
Yep. And it's something of a known issue. Using BufReader#lines is glacial (and something of a known issue) in debug mode and merely slow in release mode. My
by inferiorhuman 10y ago
Yep. And it's something of a known issue. Using BufReader#lines is glacial (and something of a known issue) in debug mode and merely slow in release mode. My understanding is that the BufReader is allocating a new String object for each line and so you're dealing with strict UTF-8 parsing and memory allocation.
My use case here is reading Vyatta config files. So lots of files that are generally (but not always) short. Mostly it's a fun teach myself Rust project, and it's hit lots of interesting edge cases in Rust, but otherwise I'd be all over just writing it in Python or Ruby.
- steveklabnik 10y agoInteresting, I did not know this.
- inferiorhuman 10y agoRelevant links: https://users.rust-lang.org/t/bufreader-100x-slower-than-python-am-i-doing-something-wrong/1426 https://users.rust-lang.org/t/bufreader-100x-slower-than-pyt... http://codereview.stackexchange.com/questions/73753/how-can-i-find-out-why-this-rust-program-to-echo-lines-from-stdin-is-slow http://codereview.stackexchange.com/questions/73753/how-can-...