Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ members = [
"crates/component-test-sdk-macro",
"crates/component-test-cli",
"crates/component-test-runner",
"components/bench-suite",
"components/drift-fixture",
"components/fixture-suite",
"components/hang-fixture",
Expand Down
10 changes: 10 additions & 0 deletions components/bench-suite/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "bench-suite"
version.workspace = true
edition.workspace = true

[lib]
crate-type = ["cdylib"]

[dependencies]
component-test-sdk = { workspace = true }
33 changes: 33 additions & 0 deletions components/bench-suite/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//! Synthetic benchmark suite: N trivially-passing cases, no corpus, no
//! per-case data — the pure cost of registering, minting, and lifting
//! `test-case` handles. Built for measuring `all()` overhead at scale
//! (issues #22/#25 territory: instance-per-case pays this per instance).
//!
//! `BENCH_CASES` (wasi:cli env) sets the case count, default 10_000.
//! Bench drivers vary it per instance; under a plain runner (which
//! passes no env) the suite is deterministic at the default, but this
//! is a measurement fixture, not a lockfile citizen — don't lock it.

#[component_test_sdk::suite]
mod bench {
use component_test_sdk::{ArcStr, Registry, Tags};

/// Registers `bench/mint/c00000`..`c<N-1>`: leaf-only allocation,
/// zero-capture bodies, no tags. The registry build cost this loop
/// represents is measured separately from the mint+lift (the
/// drivers time a second `all()` call, which reuses the registry).
#[case_row(prefix = "mint")]
fn mint(reg: &mut Registry, prefix: &ArcStr, tags: &Tags) {
let n: usize = std::env::var("BENCH_CASES")
.ok()
.and_then(|v| v.parse().ok())
.unwrap_or(10_000);
for i in 0..n {
reg.generated(
prefix,
tags,
Case::new(format!("c{i:05}"), |_ctx| Box::pin(async { Ok(()) })),
);
}
}
}
15 changes: 15 additions & 0 deletions crates/component-test-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,25 @@ futures = { workspace = true }
tokio = { workspace = true, features = ["time"] }
wasmtime = { version = "47", features = ["component-model-async"] }
wasmtime-wasi = "47"
# For the feature-gated `wizer-preinit` bin only (component-level
# pre-initialization experiments, #25 / findings.md #22).
wasmtime-wizer = { version = "47", features = ["wasmtime", "component-model"], optional = true }

[features]
wizer = ["dep:wasmtime-wizer"]

[[bin]]
name = "ct-runner"
path = "src/bin/ct-runner.rs"

[[bin]]
name = "bench-mint"
path = "src/bin/bench-mint.rs"

[[bin]]
name = "wizer-preinit"
path = "src/bin/wizer-preinit.rs"
required-features = ["wizer"]

[target.'cfg(unix)'.dependencies]
libc = "0.2"
Loading
Loading