Skip to content

Commit

Permalink
Add validation benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlansneff committed Feb 22, 2019
1 parent 70ba4ec commit 687f70d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/runtime/benches/nginx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extern crate criterion;
use criterion::Criterion;
use wasmer_runtime::{
cache::{Cache, FileSystemCache, WasmHash},
compile,
compile, validate,
};

static NGINX_WASM: &'static [u8] = include_bytes!("../../../examples/nginx/nginx.wasm");
Expand All @@ -17,6 +17,10 @@ fn load_module(cache: &impl Cache) {
cache.load(wasm_hash).unwrap();
}

fn validate_benchmark(c: &mut Criterion) {
c.bench_function("nginx validate", |b| b.iter(|| validate(NGINX_WASM)));
}

fn compile_benchmark(c: &mut Criterion) {
c.bench_function("nginx compile", |b| b.iter(|| compile_module()));
}
Expand All @@ -34,6 +38,6 @@ fn load_benchmark(c: &mut Criterion) {
criterion_group! {
name = benches;
config = Criterion::default().sample_size(10);
targets = compile_benchmark, load_benchmark
targets = validate_benchmark, compile_benchmark, load_benchmark
}
criterion_main!(benches);

0 comments on commit 687f70d

Please sign in to comment.