3 ms·
Rust is pretty nice if a bit rough with the cross compilation stuff. The big problem is speed. Compiling rust projects takes a while and some operations like
by inferiorhuman 10y ago
Rust is pretty nice if a bit rough with the cross compilation stuff. The big problem is speed. Compiling rust projects takes a while and some operations like reading a file line b line are absolutely glacial.
- steveklabnik 10y agoAre you using a BufReader for those file reads? If not, system calls will slow you way down.
- inferiorhuman 10y agoYep. 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-...