Skip to content

Commit

Permalink
perf: Buffer stderr when writing json errors/warnings
Browse files Browse the repository at this point in the history
Since `stderr` is unbuffered, writing out json messages actually take up
about ~10%/0.1s of the runtime of the `inflate` benchmark.

cc rust-lang#64413
  • Loading branch information
Markus Westerlind committed Feb 17, 2020
1 parent 75b98fb commit 7ac4154
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc_errors/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl JsonEmitter {
macro_backtrace: bool,
) -> JsonEmitter {
JsonEmitter {
dst: Box::new(io::stderr()),
dst: Box::new(io::BufWriter::new(io::stderr())),
registry,
sm: source_map,
pretty,
Expand Down

0 comments on commit 7ac4154

Please sign in to comment.