about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2014-03-18 23:40:07 +1100
committerAlex Crichton <alex@alexcrichton.com>2014-03-18 13:47:55 -0700
commit92f0bc29355ac990595e1771c4bb9a3b7e358d30 (patch)
tree6e51ab747b0532fd5109fe992c776bfd55203e96
parent873f7408bdffdb05b23f77aa343abd05f2e3126c (diff)
downloadrust-92f0bc29355ac990595e1771c4bb9a3b7e358d30.tar.gz
rust-92f0bc29355ac990595e1771c4bb9a3b7e358d30.zip
rustc: buffer the output writer for -Z ast-json[-noexpand].
This takes the time for `rustc libstd/lib.rs -Z ast-json-noexpand >
file.json` from 9.0s to 3.5s (~0.5s spent parsing etc.) and `-Z
ast-json` from 11s to 5s (~1.5s spent parsing and expanding).
-rw-r--r--src/librustc/driver/driver.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs
index e7c1e214d07..5926f535ad8 100644
--- a/src/librustc/driver/driver.rs
+++ b/src/librustc/driver/driver.rs
@@ -186,7 +186,7 @@ pub fn phase_1_parse_input(sess: &Session, cfg: ast::CrateConfig, input: &Input)
     });
 
     if sess.opts.debugging_opts & session::AST_JSON_NOEXPAND != 0 {
-        let mut stdout = io::stdout();
+        let mut stdout = io::BufferedWriter::new(io::stdout());
         let mut json = json::PrettyEncoder::new(&mut stdout);
         krate.encode(&mut json);
     }
@@ -261,7 +261,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
          front::assign_node_ids_and_map::assign_node_ids_and_map(sess, krate));
 
     if sess.opts.debugging_opts & session::AST_JSON != 0 {
-        let mut stdout = io::stdout();
+        let mut stdout = io::BufferedWriter::new(io::stdout());
         let mut json = json::PrettyEncoder::new(&mut stdout);
         krate.encode(&mut json);
     }