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
This commit is contained in:
Markus Westerlind 2020-02-17 08:09:34 +01:00
parent 75b98fbe77
commit 7ac4154643

View file

@ -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,