Hacker News new | past | comments | ask | show | jobs | submit login

Any use of `println` in Rust is going to have its performance dominated by repeatedly locking stdout and flushing the buffer every time. It's a bit of an obscure fact (since most programs aren't bottlenecked on printing), but `println` in Rust is kind of just supposed to be a convenience for hello world and print-debugging. Rust provides `writeln` for serious use, which is more verbose but allows you more fine-grained control over locking, buffering, and error-handling. See also https://nnethercote.github.io/perf-book/io.html



Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: