diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml new file mode 100644 index 000000000..b5bd8298f --- /dev/null +++ b/.github/workflows/benchmarks.yml @@ -0,0 +1,51 @@ +name: Run Benchmarks + +on: + schedule: + - cron: '0 0 * * *' # Runs daily at midnight + pull_request: + +jobs: + benchmark: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: fetch submodules + run: git submodule update --init --recursive + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + target: wasm32-wasi + - name: Setup build env + run: | + os=$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]') + ./scripts/setup-$os.sh + shell: bash + - name: Run Benchmarks + run: | + set -o pipefail + cargo bench -p containerd-shim-benchmarks -- --output-format bencher | tee output.txt + # Download previous benchmark result from cache (if exists) + - name: Cache benchmark data + uses: actions/cache@v4 + with: + path: ./cache + key: ${{ runner.os }}-benchmark + - name: Store benchmark result + uses: benchmark-action/github-action-benchmark@v1.20.3 + with: + name: Criterion.rs Benchmark + tool: 'cargo' + output-file-path: output.txt + github-token: ${{ secrets.GITHUB_TOKEN }} + # my experimental local benchmarking seems to have a 20% margin of error. + # So I set the alert threshold to 130% of the previous benchmark result. + # If the current benchmark result is more than 130% of the previous benchmark result, it will fail. + alert-threshold: '130%' + fail-on-alert: true + alert-comment-cc-users: '@runwasi-committers' + # Enable Job Summary + summary-always: true + # Where the previous data file is stored + external-data-json-path: ./cache/benchmark-data.json \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 1b9e1c62c..d9f44e1ef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -70,6 +70,12 @@ dependencies = [ "libc", ] +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + [[package]] name = "anstream" version = "0.6.14" @@ -449,6 +455,12 @@ dependencies = [ "thiserror", ] +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + [[package]] name = "cc" version = "1.0.98" @@ -513,6 +525,33 @@ dependencies = [ "windows-targets 0.52.5", ] +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half 2.4.1", +] + [[package]] name = "clang-sys" version = "1.7.0" @@ -636,6 +675,23 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "containerd-shim-benchmarks" +version = "0.4.0" +dependencies = [ + "anyhow", + "chrono", + "containerd-shim-wasm", + "containerd-shim-wasmtime", + "criterion", + "libc", + "oci-spec", + "serde", + "serde_json", + "tempfile", + "wasmtime", +] + [[package]] name = "containerd-shim-protos" version = "0.7.0" @@ -1004,6 +1060,42 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "criterion" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" +dependencies = [ + "anes", + "cast", + "ciborium", + "clap", + "criterion-plot", + "is-terminal", + "itertools 0.10.5", + "num-traits", + "once_cell", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +dependencies = [ + "cast", + "itertools 0.10.5", +] + [[package]] name = "critical-section" version = "1.1.2" @@ -1066,6 +1158,12 @@ version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "crypto-common" version = "0.1.6" @@ -1766,6 +1864,16 @@ version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" +[[package]] +name = "half" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if 1.0.0", + "crunchy", +] + [[package]] name = "hash32" version = "0.2.1" @@ -2641,6 +2749,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + [[package]] name = "openssl" version = "0.10.64" @@ -2846,6 +2960,34 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +[[package]] +name = "plotters" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" + +[[package]] +name = "plotters-svg" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" +dependencies = [ + "plotters-backend", +] + [[package]] name = "postcard" version = "1.0.8" @@ -3636,7 +3778,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" dependencies = [ - "half", + "half 1.8.3", "serde", ] @@ -4078,6 +4220,16 @@ dependencies = [ "time-core", ] +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "tinyvec" version = "1.6.0" diff --git a/Cargo.toml b/Cargo.toml index 4a2ce891c..d0090ad4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,8 @@ members = [ "crates/oci-tar-builder", "crates/containerd-shim-wasmedge", "crates/containerd-shim-wasmtime", - "crates/containerd-shim-wasmer" + "crates/containerd-shim-wasmer", + "benches/containerd-shim-benchmarks", ] resolver = "2" @@ -46,5 +47,9 @@ windows-sys = "0.52" serial_test = "2" tracing = "0.1" +# wasmtime +wasmtime = { version = "21.0.1", features = ["async"] } +wasmtime-wasi = { version = "21.0.1" } + [profile.release] panic = "abort" diff --git a/Makefile b/Makefile index 1e43a527c..197e2784b 100644 --- a/Makefile +++ b/Makefile @@ -315,6 +315,10 @@ test/k3s-oci-%: dist/img-oci.tar bin/k3s dist-% .PHONY: test/k3s/clean test/k3s/clean: bin/k3s/clean; +.PHONY: bench +bench: + $(CARGO) bench -p containerd-shim-benchmarks + .PHONY: clean clean: -rm -rf dist diff --git a/benches/containerd-shim-benchmarks/Cargo.toml b/benches/containerd-shim-benchmarks/Cargo.toml index fd354da7d..fd704bc59 100644 --- a/benches/containerd-shim-benchmarks/Cargo.toml +++ b/benches/containerd-shim-benchmarks/Cargo.toml @@ -6,18 +6,18 @@ edition.workspace = true [dependencies] anyhow = { workspace = true } chrono = { workspace = true } -containerd-shim-wasm = { path = "../../crates/containerd-shim-wasm" } -containerd-shim-wasmedge = { path = "../../crates/containerd-shim-wasmedge" } +containerd-shim-wasm = { path = "../../crates/containerd-shim-wasm", features = ["testing"] } containerd-shim-wasmtime = { path = "../../crates/containerd-shim-wasmtime" } libc = { workspace = true } oci-spec = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } tempfile = "3.8" +wasmtime = { workspace = true } [dev-dependencies] criterion = { version = "0.5", features = ["html_reports"] } [[bench]] -name = "webassembly-benchmarks" +name = "wasmtime-benchmarks" harness = false \ No newline at end of file diff --git a/benches/containerd-shim-benchmarks/benches/wasmtime-benchmarks.rs b/benches/containerd-shim-benchmarks/benches/wasmtime-benchmarks.rs new file mode 100644 index 000000000..a0a8a1b68 --- /dev/null +++ b/benches/containerd-shim-benchmarks/benches/wasmtime-benchmarks.rs @@ -0,0 +1,175 @@ +use std::borrow::Cow; +use std::time::Duration; + +use containerd_shim_wasm::container::Instance; +use containerd_shim_wasm::sandbox::Error; +use containerd_shim_wasm::testing::WasiTest; +use containerd_shim_wasmtime::instance::{WasiConfig, WasmtimeEngine}; +use criterion::measurement::WallTime; +use criterion::{criterion_group, criterion_main, BenchmarkGroup, Criterion}; + +/* + For benchmarking try to choose cases which run fast enough -- the idea is to + get a rough idea of the performance rather than run a hours-long benchmark + suite. + + Because of this, only select the benchmarks which run in under 5 seconds on + a desktop computer using WasmEdge. Note that this selection is pretty + arbitrary and we can add or remove benchmarks easily, also from other + sources. This is the selection algorithm: + + $ for file in *; do if timeout 5s wasmedge "${file}" > /dev/null; then echo "$file"; fi; done + aead_chacha20poly13052.wasm + aead_chacha20poly1305.wasm + aead_xchacha20poly1305.wasm + auth2.wasm + auth3.wasm + auth6.wasm + auth.wasm + box_seed.wasm + generichash2.wasm + generichash3.wasm + hash3.wasm + hash.wasm + kdf.wasm + keygen.wasm + onetimeauth2.wasm + onetimeauth.wasm + scalarmult2.wasm + scalarmult5.wasm + scalarmult6.wasm + secretbox2.wasm + secretbox_easy.wasm + secretbox.wasm + secretstream_xchacha20poly1305.wasm + shorthash.wasm + siphashx24.wasm + stream3.wasm + stream4.wasm + + Criterion is set to run each benchmark ten times, ten being the minimum + number of iterations that Criterion accepts. If we need more statistically + meaningful results we can increase the number of iterations (with the cost + of a longer benchmarking time). Running the whole suite on a desktop + computer takes now a bit over 10 minutes. +*/ +#[derive(Clone)] +struct WasiTestConfig {} + +impl WasiConfig for WasiTestConfig { + fn new_config() -> wasmtime::Config { + let mut config = wasmtime::Config::new(); + // Disable Wasmtime parallel compilation for the tests + // see https://github.com/containerd/runwasi/pull/405#issuecomment-1928468714 for details + config.parallel_compilation(false); + config.wasm_component_model(true); // enable component linking + config + } +} + +type WasmtimeTestInstance = Instance>; + +fn run_wasmtime_test_with_spec(wasmbytes: &[u8]) -> Result { + let (exit_code, _, _) = WasiTest::::builder()? + .with_wasm(wasmbytes)? + .build()? + .start()? + .wait(Duration::from_secs(10))?; + Ok(exit_code) +} + +fn run_wasmtime_benchmark(group: &mut BenchmarkGroup, bytes: &[u8]) { + group.bench_function("Wasmtime", |b| { + b.iter(|| { + let res = run_wasmtime_test_with_spec(bytes); + match res { + Err(e) => { + panic!("Error running Wasmtime benchmark: {}", e); + } + Ok(status) => { + assert_eq!(status, 0); + } + } + }) + }); +} + +macro_rules! bench_wasm { + ($name:ident) => { + fn $name(c: &mut Criterion) { + let wasmbytes = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../benches/webassembly-benchmarks/2022-12/wasm/", stringify!($name), ".wasm")); + let bytes = Cow::from(wasmbytes); + let mut group = c.benchmark_group(stringify!($name)); + run_wasmtime_benchmark(&mut group, &bytes); + group.finish(); + } + }; + ($name:ident, $($rest:tt),+) => { + bench_wasm!($name); + bench_wasm!($($rest),+); + }; +} + +bench_wasm! { + aead_chacha20poly13052, + aead_chacha20poly1305, + aead_xchacha20poly1305, + auth2, + auth3, + auth6, + auth, + box_seed, + generichash2, + generichash3, + hash3, + hash, + kdf, + keygen, + onetimeauth2, + onetimeauth, + scalarmult2, + scalarmult5, + scalarmult6, + secretbox2, + secretbox_easy, + secretbox, + secretstream_xchacha20poly1305, + shorthash, + siphashx24, + stream3, + stream4 +} + +criterion_group! { + name = benches; + config = Criterion::default().sample_size(10); + targets = aead_chacha20poly13052, + aead_chacha20poly1305, + aead_xchacha20poly1305, + auth2, + auth3, + auth6, + auth, + box_seed, + generichash2, + generichash3, + hash3, + hash, + kdf, + keygen, + onetimeauth2, + onetimeauth, + scalarmult2, + scalarmult5, + scalarmult6, + secretbox2, + secretbox_easy, + secretbox, + secretstream_xchacha20poly1305, + shorthash, + siphashx24, + stream3, + stream4 +} + +criterion_main!(benches); diff --git a/benches/containerd-shim-benchmarks/benches/webassembly-benchmarks.rs b/benches/containerd-shim-benchmarks/benches/webassembly-benchmarks.rs deleted file mode 100644 index 1b16f53c8..000000000 --- a/benches/containerd-shim-benchmarks/benches/webassembly-benchmarks.rs +++ /dev/null @@ -1,361 +0,0 @@ -use criterion::{criterion_group, criterion_main, Criterion}; - -use std::borrow::Cow; -use std::fs::{create_dir, File, OpenOptions}; -use std::io::Write; -use std::os::unix::prelude::OpenOptionsExt; -use std::path::{Path, PathBuf}; -use std::sync::mpsc::channel; -use std::sync::Arc; -use std::time::Duration; - -use anyhow::bail; -use chrono::{DateTime, Utc}; - -use containerd_shim_wasm::sandbox::exec::has_cap_sys_admin; -use containerd_shim_wasm::sandbox::instance::Wait; -use containerd_shim_wasm::sandbox::{Error, Instance, InstanceConfig}; - -use containerd_shim_wasmedge::instance::{reset_stdio, Wasi as WasmEdgeWasi}; -use containerd_shim_wasmtime::instance::Wasi as WasmtimeWasi; -use libc::SIGKILL; -use oci_spec::runtime::{ProcessBuilder, RootBuilder, Spec, SpecBuilder}; -use serde::{Deserialize, Serialize}; -use tempfile::{tempdir, TempDir}; - -/* - For benchmarking try to choose cases which run fast enough -- the idea is to - get a rough idea of the performance rather than run a hours-long benchmark - suite. - - Because of this, only select the benchmarks which run in under 5 seconds on - a desktop computer using WasmEdge. Note that this selection is pretty - arbitrary and we can add or remove benchmarks easily, also from other - sources. This is the selection algorithm: - - $ for file in *; do if timeout 5s wasmedge "${file}" > /dev/null; then echo "$file"; fi; done - aead_chacha20poly13052.wasm - aead_chacha20poly1305.wasm - aead_xchacha20poly1305.wasm - auth2.wasm - auth3.wasm - auth6.wasm - auth.wasm - box_seed.wasm - generichash2.wasm - generichash3.wasm - hash3.wasm - hash.wasm - kdf.wasm - keygen.wasm - onetimeauth2.wasm - onetimeauth.wasm - scalarmult2.wasm - scalarmult5.wasm - scalarmult6.wasm - secretbox2.wasm - secretbox_easy.wasm - secretbox.wasm - secretstream_xchacha20poly1305.wasm - shorthash.wasm - siphashx24.wasm - stream3.wasm - stream4.wasm - - Criterion is set to run each benchmark ten times, ten being the minimum - number of iterations that Criterion accepts. If we need more statistically - meaningful results we can increase the number of iterations (with the cost - of a longer benchmarking time). Running the whole suite on a desktop - computer takes now a bit over 10 minutes. -*/ - -#[derive(Serialize, Deserialize)] -struct Options { - root: Option, -} - -fn get_external_benchmark_module(name: String) -> Result, Error> { - let manifest_dir = env!("CARGO_MANIFEST_DIR"); - let target = Path::new(manifest_dir) - .join("../../benches/webassembly-benchmarks/2022-12/wasm") - .join(name.clone()); - std::fs::read(target).map_err(|e| { - Error::Others(format!( - "failed to read requested Wasm module ({}): {}.", - name, e - )) - }) -} - -fn run_wasmtime_test_with_spec( - dir: &TempDir, - spec: &Spec, - wasmbytes: &[u8], -) -> Result<(u32, DateTime), Error> { - create_dir(dir.path().join("rootfs"))?; - - let wasm_path = dir.path().join("rootfs/file.wasm"); - let mut f = OpenOptions::new() - .write(true) - .create(true) - .truncate(true) - .mode(0o755) - .open(wasm_path)?; - f.write_all(wasmbytes)?; - - let stdout = File::create(dir.path().join("stdout"))?; - drop(stdout); - - spec.save(dir.path().join("config.json"))?; - - let mut cfg = InstanceConfig::new(WasmtimeWasi::new_engine()?, "test_namespace".into()); - let cfg = cfg - .set_bundle(dir.path().to_str().unwrap().to_string()) - .set_stdout(dir.path().join("stdout").to_str().unwrap().to_string()); - - let wasi = Arc::new(WasmtimeWasi::new("test".to_string(), Some(cfg))); - - wasi.start()?; - - let (tx, rx) = channel(); - let waiter = Wait::new(tx); - wasi.wait(&waiter).unwrap(); - - let res = match rx.recv_timeout(Duration::from_secs(60)) { - Ok(res) => Ok(res), - Err(e) => { - wasi.kill(SIGKILL as u32).unwrap(); - return Err(Error::Others(format!( - "error waiting for module to finish: {0}", - e - ))); - } - }; - - wasi.delete()?; - res -} - -fn run_wasmedge_test_with_spec( - dir: &TempDir, - spec: &Spec, - wasmbytes: &[u8], -) -> Result<(u32, DateTime), Error> { - create_dir(dir.path().join("rootfs"))?; - let rootdir = dir.path().join("runwasi"); - create_dir(&rootdir)?; - let opts = Options { - root: Some(rootdir), - }; - let opts_file = OpenOptions::new() - .read(true) - .create(true) - .truncate(true) - .write(true) - .open(dir.path().join("options.json"))?; - write!(&opts_file, "{}", serde_json::to_string(&opts)?)?; - - let wasm_path = dir.path().join("rootfs/file.wasm"); - let mut f = OpenOptions::new() - .write(true) - .create(true) - .truncate(true) - .mode(0o755) - .open(wasm_path)?; - f.write_all(wasmbytes)?; - - let stdout = File::create(dir.path().join("stdout"))?; - drop(stdout); - - spec.save(dir.path().join("config.json"))?; - - let mut cfg = InstanceConfig::new(WasmEdgeWasi::new_engine()?, "test_namespace".into()); - let cfg = cfg - .set_bundle(dir.path().to_str().unwrap().to_string()) - .set_stdout(dir.path().join("stdout").to_str().unwrap().to_string()); - - let wasi = Arc::new(WasmEdgeWasi::new("test".to_string(), Some(cfg))); - - wasi.start()?; - - let (tx, rx) = channel(); - let waiter = Wait::new(tx); - wasi.wait(&waiter).unwrap(); - - let res = match rx.recv_timeout(Duration::from_secs(600)) { - Ok(res) => Ok(res), - Err(e) => { - wasi.kill(SIGKILL as u32).unwrap(); - return Err(Error::Others(format!( - "error waiting for module to finish: {0}", - e - ))); - } - }; - wasi.delete()?; - res -} - -fn run_bench(c: &mut Criterion, name: &str) -> Result<(), Error> { - if !has_cap_sys_admin() { - return Err(Error::Others(String::from( - "Please run the benchmark with sudo", - ))); - } - - let wasmbytes = get_external_benchmark_module(format!("{}.wasm", name))?; - - let spec = SpecBuilder::default() - .root(RootBuilder::default().path("rootfs").build()?) - .process( - ProcessBuilder::default() - .cwd("/") - .args(vec!["./file.wasm".to_string()]) - .build()?, - ) - .build()?; - - let bytes = Cow::from(wasmbytes); - - let mut group = c.benchmark_group(name); - group.bench_function("Wasmtime", |b| { - b.iter(|| { - let dir = tempdir().unwrap(); - let res = run_wasmtime_test_with_spec(&dir, &spec, &bytes); - match res { - Err(e) => bail!("Error running Wasmtime benchmark: {}", e), - _ => Ok(()), - } - }) - }); - group.bench_function("WasmEdge", |b| { - b.iter(|| { - let dir = tempdir().unwrap(); - let res = run_wasmedge_test_with_spec(&dir, &spec, &bytes); - match res { - Err(e) => bail!("Error running WasmEdge benchmark: {}", e), - _ => Ok(()), - } - }) - }); - reset_stdio(); - group.finish(); - - Ok(()) -} - -fn bench_aead_chacha20poly1305(b: &mut Criterion) { - run_bench(b, "aead_chacha20poly1305").unwrap() -} - -fn bench_aead_chacha20poly13052(b: &mut Criterion) { - run_bench(b, "aead_chacha20poly13052").unwrap() -} - -fn bench_aead_xchacha20poly1305(b: &mut Criterion) { - run_bench(b, "aead_xchacha20poly1305").unwrap() -} - -fn bench_auth2(b: &mut Criterion) { - run_bench(b, "auth2").unwrap() -} - -fn bench_auth3(b: &mut Criterion) { - run_bench(b, "auth3").unwrap() -} - -fn bench_auth6(b: &mut Criterion) { - run_bench(b, "auth6").unwrap() -} - -fn bench_auth(b: &mut Criterion) { - run_bench(b, "auth").unwrap() -} - -fn bench_box_seed(b: &mut Criterion) { - run_bench(b, "box_seed").unwrap() -} - -fn bench_generichash2(b: &mut Criterion) { - run_bench(b, "generichash2").unwrap() -} - -fn bench_generichash3(b: &mut Criterion) { - run_bench(b, "generichash3").unwrap() -} - -fn bench_hash3(b: &mut Criterion) { - run_bench(b, "hash3").unwrap() -} - -fn bench_hash(b: &mut Criterion) { - run_bench(b, "hash").unwrap() -} - -fn bench_kdf(b: &mut Criterion) { - run_bench(b, "kdf").unwrap() -} - -fn bench_keygen(b: &mut Criterion) { - run_bench(b, "keygen").unwrap() -} - -fn bench_onetimeauth2(b: &mut Criterion) { - run_bench(b, "onetimeauth2").unwrap() -} - -fn bench_onetimeauth(b: &mut Criterion) { - run_bench(b, "onetimeauth").unwrap() -} - -fn bench_scalarmult2(b: &mut Criterion) { - run_bench(b, "scalarmult2").unwrap() -} - -fn bench_scalarmult5(b: &mut Criterion) { - run_bench(b, "scalarmult5").unwrap() -} - -fn bench_scalarmult6(b: &mut Criterion) { - run_bench(b, "scalarmult6").unwrap() -} - -fn bench_secretbox2(b: &mut Criterion) { - run_bench(b, "secretbox2").unwrap() -} - -fn bench_secretbox_easy(b: &mut Criterion) { - run_bench(b, "secretbox_easy").unwrap() -} - -fn bench_secretbox(b: &mut Criterion) { - run_bench(b, "secretbox").unwrap() -} - -fn bench_secretstream_xchacha20poly1305(b: &mut Criterion) { - run_bench(b, "secretstream_xchacha20poly1305").unwrap() -} - -fn bench_shorthash(b: &mut Criterion) { - run_bench(b, "shorthash").unwrap() -} - -fn bench_siphashx24(b: &mut Criterion) { - run_bench(b, "siphashx24").unwrap() -} - -fn bench_stream3(b: &mut Criterion) { - run_bench(b, "stream3").unwrap() -} - -fn bench_stream4(b: &mut Criterion) { - run_bench(b, "stream4").unwrap() -} - -criterion_group! { - name = benches; - config = Criterion::default().sample_size(10); - targets = bench_aead_chacha20poly13052, bench_aead_chacha20poly1305, bench_aead_xchacha20poly1305, bench_auth2, bench_auth3, bench_auth6, bench_auth, bench_box_seed, bench_generichash2, bench_generichash3, bench_hash3, bench_hash, bench_kdf, bench_keygen, bench_onetimeauth2, bench_onetimeauth, bench_scalarmult2, bench_scalarmult5, bench_scalarmult6, bench_secretbox2, bench_secretbox_easy, bench_secretbox, bench_secretstream_xchacha20poly1305, bench_shorthash, bench_siphashx24, bench_stream3, bench_stream4 -} - -criterion_main!(benches); diff --git a/crates/containerd-shim-wasmtime/Cargo.toml b/crates/containerd-shim-wasmtime/Cargo.toml index a60682fe0..296aac610 100644 --- a/crates/containerd-shim-wasmtime/Cargo.toml +++ b/crates/containerd-shim-wasmtime/Cargo.toml @@ -12,8 +12,8 @@ oci-spec = { workspace = true, features = ["runtime"] } ttrpc = { workspace = true } sha256 = { workspace = true } -wasmtime = { version = "21.0.1", features = ["async"] } -wasmtime-wasi = { version = "21.0.1" } +wasmtime = { workspace = true } +wasmtime-wasi = { workspace = true } [dev-dependencies] containerd-shim-wasm = { workspace = true, features = ["testing"] }