about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2022-07-23 23:34:31 +0200
committerGitHub <noreply@github.com>2022-07-23 23:34:31 +0200
commit74c3da39f0b32eb6744caff1353ba35be2a25768 (patch)
tree594bdfb842eb3450bfc2632c8fe0708e75a688d5
parent90c6cde43a9b45017375231bfd8f0eb38f9b4a04 (diff)
parent90dc0b02ae38185eee3e6490f7ff47b50297f22b (diff)
downloadrust-74c3da39f0b32eb6744caff1353ba35be2a25768.tar.gz
rust-74c3da39f0b32eb6744caff1353ba35be2a25768.zip
Rollup merge of #99627 - saethlin:lock-once, r=eddyb
Lock stdout once when listing tests

This is a marginal optimization for normal operation, but for `cargo miri nextest list` (which is invoked by `cargo miri nextest run`) this knocks the startup time on `regex` down from 87 seconds to 17 seconds. Still slow, but a nice 5x improvement.
-rw-r--r--library/test/src/console.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/test/src/console.rs b/library/test/src/console.rs
index dc0123cf432..e9dda98966d 100644
--- a/library/test/src/console.rs
+++ b/library/test/src/console.rs
@@ -137,7 +137,7 @@ impl ConsoleTestState {
 // List the tests to console, and optionally to logfile. Filters are honored.
 pub fn list_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Result<()> {
     let mut output = match term::stdout() {
-        None => OutputLocation::Raw(io::stdout()),
+        None => OutputLocation::Raw(io::stdout().lock()),
         Some(t) => OutputLocation::Pretty(t),
     };