]> git.lizzy.rs Git - rust.git/commit
Sort tests at compile time, not at startup
authorBen Kimock <kimockb@gmail.com>
Tue, 26 Jul 2022 21:40:48 +0000 (17:40 -0400)
committerBen Kimock <kimockb@gmail.com>
Thu, 1 Sep 2022 13:04:25 +0000 (09:04 -0400)
commitdf6221adc6ad721af59acd501dbfce426b1298da
treeac6198562d44420adf93c680ed6861113809bcfa
parent4f9898a7947059433d08357cdaaba84c4705873d
Sort tests at compile time, not at startup

Recently, another Miri user was trying to run `cargo miri test` on the
crate `iced-x86` with `--features=code_asm,mvex`. This configuration has
a startup time of ~18 minutes. That's ~18 minutes before any tests even
start to run. The fact that this crate has over 26,000 tests and Miri is
slow makes a lot of code which is otherwise a bit sloppy but fine into a
huge runtime issue.

Sorting the tests when the test harness is created instead of at startup
time knocks just under 4 minutes out of those ~18 minutes. I have ways
to remove most of the rest of the startup time, but this change requires
coordinating changes of both the compiler and libtest, so I'm sending it
separately.
compiler/rustc_builtin_macros/src/test.rs
compiler/rustc_builtin_macros/src/test_harness.rs
compiler/rustc_feature/src/builtin_attrs.rs
library/test/src/console.rs
library/test/src/lib.rs
library/test/src/tests.rs
src/librustdoc/doctest.rs
src/test/pretty/tests-are-sorted.pp [new file with mode: 0644]
src/test/pretty/tests-are-sorted.rs [new file with mode: 0644]
src/tools/compiletest/src/main.rs