diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2022-07-23 23:34:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-23 23:34:31 +0200 |
| commit | 74c3da39f0b32eb6744caff1353ba35be2a25768 (patch) | |
| tree | 594bdfb842eb3450bfc2632c8fe0708e75a688d5 | |
| parent | 90c6cde43a9b45017375231bfd8f0eb38f9b4a04 (diff) | |
| parent | 90dc0b02ae38185eee3e6490f7ff47b50297f22b (diff) | |
| download | rust-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.rs | 2 |
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), }; |
