about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarkus Westerlind <markus.westerlind@distilnetworks.com>2020-02-17 08:09:34 +0100
committerMarkus Westerlind <markus.westerlind@distilnetworks.com>2020-02-17 15:35:42 +0100
commit7ac4154643a952fed1d942adcb78e27b17ad41dd (patch)
treed4dd87bd5bed8ebfe0666a94bfa71a2464a7d4f6
parent75b98fbe77d472d85d1691bae5b25e7eefb3609c (diff)
downloadrust-7ac4154643a952fed1d942adcb78e27b17ad41dd.tar.gz
rust-7ac4154643a952fed1d942adcb78e27b17ad41dd.zip
perf: Buffer stderr when writing json errors/warnings
Since `stderr` is unbuffered, writing out json messages actually take up
about ~10%/0.1s of the runtime of the `inflate` benchmark.

cc #64413
-rw-r--r--src/librustc_errors/json.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_errors/json.rs b/src/librustc_errors/json.rs
index ffdff6acec5..f0cfd815a2c 100644
--- a/src/librustc_errors/json.rs
+++ b/src/librustc_errors/json.rs
@@ -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,