Skip to content

Commit 7b718b8

Browse files
committed
switch from async to rayon
1 parent 918ec6a commit 7b718b8

File tree

8 files changed

+148
-641
lines changed

8 files changed

+148
-641
lines changed

Cargo.lock

+1-403
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testing/conformance/Cargo.toml

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ cid = { workspace = true }
2121
serde = { version = "1.0", features = ["derive"] }
2222
lazy_static = "1.5.0"
2323
log = "0.4.27"
24-
futures = "0.3.31"
25-
async-std = { version = "1.13", features = ["attributes"] }
2624
wasmtime = { workspace = true }
2725
base64 = "0.22.1"
2826
flate2 = { version = "1.1" }
@@ -44,7 +42,8 @@ m2-native = []
4442

4543
[dev-dependencies]
4644
env_logger = "0.11.8"
47-
criterion = { version = "0.5", features = ["async_std"] }
45+
criterion = { version = "0.5" }
46+
rayon = "1.10.0"
4847

4948
[[bin]]
5049
name = "perf-conformance"

testing/conformance/benches/bench_drivers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub fn bench_vector_file(
9999
name: &str,
100100
engines: &MultiEngine,
101101
) -> anyhow::Result<()> {
102-
let (bs, _) = async_std::task::block_on(vector.seed_blockstore()).unwrap();
102+
let (bs, _) = vector.seed_blockstore().unwrap();
103103

104104
for variant in vector.preconditions.variants.iter() {
105105
let name = format!("{} | {}", name, variant.id);

testing/conformance/src/actors.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Copyright 2021-2023 Protocol Labs
22
// SPDX-License-Identifier: Apache-2.0, MIT
3-
use std::io::Read;
43
use std::sync::Mutex;
54

65
use fvm_ipld_blockstore::{Blockstore, MemoryBlockstore};
@@ -20,10 +19,7 @@ fn load_bundles(bundles: &[&[u8]]) -> anyhow::Result<MemoryBlockstore> {
2019
for bundle in bundles {
2120
let mut reader = tar::Archive::new(zstd::Decoder::with_buffer(*bundle)?);
2221
for entry in reader.entries()? {
23-
// We need to read it to a vec first as we can't send it between threads (async issues).
24-
let mut car = Vec::new();
25-
entry?.read_to_end(&mut car)?;
26-
load_car(&bs, &*car)?;
22+
load_car(&bs, entry?)?;
2723
}
2824
}
2925
Ok(bs)

testing/conformance/src/bin/perf-conformance.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn main() {
4747
)
4848
.expect("failed to construct engine");
4949

50-
let (bs, _) = async_std::task::block_on(vector.seed_blockstore()).unwrap();
50+
let (bs, _) = vector.seed_blockstore().unwrap();
5151
for variant in vector.preconditions.variants.iter() {
5252
run_variant_for_perf(bs.clone(), &vector, variant, &engine, itt_info)
5353
}

testing/conformance/src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,10 @@ macro_rules! report {
1818
($status:expr, $path:expr, $id:expr) => {
1919
println!("[{}] vector: {} | variant: {}", $status, $path, $id);
2020
};
21+
($status:expr, $path:expr, $id:expr, $reason:expr) => {
22+
println!(
23+
"[{}] vector: {} | variant: {}\n\t|> reason: {:#}",
24+
$status, $path, $id, $reason
25+
);
26+
};
2127
}

testing/conformance/src/vector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl MessageVector {
181181
impl MessageVector {
182182
/// Seeds a new blockstore with the CAR encoded in the test vector and all available bundled
183183
/// actors. Returns the blockstore and the root CID.
184-
pub async fn seed_blockstore(&self) -> anyhow::Result<(MemoryBlockstore, Vec<Cid>)> {
184+
pub fn seed_blockstore(&self) -> anyhow::Result<(MemoryBlockstore, Vec<Cid>)> {
185185
let blockstore = MemoryBlockstore::new();
186186
load_actors(&blockstore)?;
187187

0 commit comments

Comments
 (0)