about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-09-10 17:19:31 +0200
committerGitHub <noreply@github.com>2019-09-10 17:19:31 +0200
commit8d2ef194a10fb1e1d2355170e30fef27a45b315b (patch)
tree8749ccd569e23e3b3c38a78578a72b11e8ffdd24
parent26a4af97436ff5e63367da8e24d529831808f887 (diff)
parent1e7faef2204f02d79506559d298f61dc3dcd24b3 (diff)
downloadrust-8d2ef194a10fb1e1d2355170e30fef27a45b315b.tar.gz
rust-8d2ef194a10fb1e1d2355170e30fef27a45b315b.zip
Rollup merge of #64344 - eddyb:mir-opt-stop-shouting-at-the-kernel, r=oli-obk
rustc_mir: buffer -Zdump-mir output instead of pestering the kernel constantly.

This brings `mir-opt` tests from `197s` (over 3 minutes!) to `2.85s`, on my build server.
That's a nice speedup of about `69x` and so it definitely fixes #58485, for me.

It's such a beginner mistake I feel like maybe `clippy` should lint against it?
(cc @Manishearth @oli-obk)
-rw-r--r--src/librustc_mir/util/pretty.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs
index ac2701971df..c35c9e4da9f 100644
--- a/src/librustc_mir/util/pretty.rs
+++ b/src/librustc_mir/util/pretty.rs
@@ -227,12 +227,12 @@ pub(crate) fn create_dump_file(
     pass_name: &str,
     disambiguator: &dyn Display,
     source: MirSource<'tcx>,
-) -> io::Result<fs::File> {
+) -> io::Result<io::BufWriter<fs::File>> {
     let file_path = dump_path(tcx, extension, pass_num, pass_name, disambiguator, source);
     if let Some(parent) = file_path.parent() {
         fs::create_dir_all(parent)?;
     }
-    fs::File::create(&file_path)
+    Ok(io::BufWriter::new(fs::File::create(&file_path)?))
 }
 
 /// Write out a human-readable textual representation for the given MIR.