rust-cli / team

CLI working group
https://rust-cli.github.io/book
MIT License
296 stars 34 forks source link

Book: Mention stdout().lock() #86

Closed killercup closed 6 years ago

killercup commented 6 years ago

because https://twitter.com/steveklabnik/status/1042454785960620032

spacekookie commented 6 years ago

LGTM :)

killercup commented 6 years ago

Thanks so much for your feedback, @BurntSushi, @spacekookie!

I've updated the text to actually make this a subsection. It comes up as a performance tip quite often, and I've heard stories of people being surprised that Rust was slower than Node/Python/Ruby simply because of the fact that we don't automatically buffer things (file read/writes in most cases).

The code example now includes three steps with comments. This means I couldn't really put in your (very nice) io::BufWriter::new(io::stdout()) shortcut, @BurntSushi. Do you think people can figure it out themselves? I hope so :)

…and @spacekookie already merged while I was writing this. Cool!

spacekookie commented 6 years ago

:sweat_smile: If there's more changes to make, I guess #58 is the place to discuss them