1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-08 15:19:40 -05:00
denoland-deno/bench_util
2024-12-31 19:12:39 +00:00
..
benches chore: Happy New Year 2025 (#27509) 2024-12-31 19:12:39 +00:00
Cargo.toml chore: Happy New Year 2025 (#27509) 2024-12-31 19:12:39 +00:00
js_runtime.rs chore: Happy New Year 2025 (#27509) 2024-12-31 19:12:39 +00:00
lib.rs chore: Happy New Year 2025 (#27509) 2024-12-31 19:12:39 +00:00
profiling.rs chore: Happy New Year 2025 (#27509) 2024-12-31 19:12:39 +00:00
README.md chore: cargo fmt - turn on group_imports=StdExternalCrate (#26646) 2024-12-31 12:13:39 -05:00

Benching utility for deno_core op system

Example:

use deno_bench_util::bench_js_sync;
use deno_bench_util::bench_or_profile;
use deno_bench_util::bencher::benchmark_group;
use deno_bench_util::bencher::Bencher;
use deno_core::Extension;

#[op2]
#[number]
fn op_nop() -> usize {
  9
}

fn setup() -> Vec<Extension> {
  vec![Extension {
    name: "my_ext"
    ops: std::borrow::Cow::Borrowed(&[op_nop::DECL])
  }]
}

fn bench_op_nop(b: &mut Bencher) {
  bench_js_sync(b, r#"Deno.core.ops.op_nop();"#, setup);
}

benchmark_group!(benches, bench_op_nop);
bench_or_profile!(benches);