Remove rayon dependency, use std::thread
This commit is contained in:
parent
faa4a4ce9e
commit
a6b3de8883
52
Cargo.lock
generated
52
Cargo.lock
generated
|
|
@ -11,37 +11,6 @@ dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crossbeam-deque"
|
|
||||||
version = "0.8.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
|
|
||||||
dependencies = [
|
|
||||||
"crossbeam-epoch",
|
|
||||||
"crossbeam-utils",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crossbeam-epoch"
|
|
||||||
version = "0.9.18"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
|
|
||||||
dependencies = [
|
|
||||||
"crossbeam-utils",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crossbeam-utils"
|
|
||||||
version = "0.8.21"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "either"
|
|
||||||
version = "1.15.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.184"
|
version = "0.2.184"
|
||||||
|
|
@ -54,26 +23,6 @@ version = "2.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
|
checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rayon"
|
|
||||||
version = "1.11.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f"
|
|
||||||
dependencies = [
|
|
||||||
"either",
|
|
||||||
"rayon-core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rayon-core"
|
|
||||||
version = "1.13.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
|
|
||||||
dependencies = [
|
|
||||||
"crossbeam-deque",
|
|
||||||
"crossbeam-utils",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.12.3"
|
version = "1.12.3"
|
||||||
|
|
@ -108,6 +57,5 @@ name = "shout"
|
||||||
version = "0.0.18"
|
version = "0.0.18"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"rayon",
|
|
||||||
"regex",
|
"regex",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,4 @@ edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
rayon = "1"
|
|
||||||
regex = "1"
|
regex = "1"
|
||||||
|
|
|
||||||
23
src/main.rs
23
src/main.rs
|
|
@ -597,8 +597,6 @@ fn main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
if opts.parallel {
|
if opts.parallel {
|
||||||
use rayon::prelude::*;
|
|
||||||
|
|
||||||
// Pre-assign ports
|
// Pre-assign ports
|
||||||
let file_ports: Vec<(PathBuf, u16)> = files
|
let file_ports: Vec<(PathBuf, u16)> = files
|
||||||
.iter()
|
.iter()
|
||||||
|
|
@ -606,16 +604,19 @@ fn main() {
|
||||||
.map(|(i, f)| (f.clone(), opts.port_from + i as u16))
|
.map(|(i, f)| (f.clone(), opts.port_from + i as u16))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let par_results: Vec<TestResult> = file_ports
|
let mut par_results: Vec<Option<TestResult>> = file_ports.iter().map(|_| None).collect();
|
||||||
.par_iter()
|
std::thread::scope(|s| {
|
||||||
.map(|(f, port)| {
|
let handles: Vec<_> = file_ports
|
||||||
let r = run_one(f, *port, &opts, timeout_ms, &cwd);
|
.iter()
|
||||||
|
.map(|(f, port)| s.spawn(|| run_one(f, *port, &opts, timeout_ms, &cwd)))
|
||||||
|
.collect();
|
||||||
|
for (slot, handle) in par_results.iter_mut().zip(handles) {
|
||||||
|
let r = handle.join().expect("thread panicked");
|
||||||
print_error_dot(&r);
|
print_error_dot(&r);
|
||||||
r
|
*slot = Some(r);
|
||||||
})
|
}
|
||||||
.collect();
|
});
|
||||||
|
results.extend(par_results.into_iter().map(|r| r.unwrap()));
|
||||||
results.extend(par_results);
|
|
||||||
let _ = writeln!(stdout());
|
let _ = writeln!(stdout());
|
||||||
} else {
|
} else {
|
||||||
for file_path in &files {
|
for file_path in &files {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user