1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-21 04:52:26 -05:00
denoland-deno/bench_util
denobot 4ee86d8d12
2.1.6 (#27704)
Bumped versions for 2.1.6

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-01-17 00:35:01 +01:00
..
benches chore: Happy New Year 2025 (#27509) 2025-01-09 15:19:16 -05:00
Cargo.toml 2.1.6 (#27704) 2025-01-17 00:35:01 +01:00
js_runtime.rs chore: Happy New Year 2025 (#27509) 2025-01-09 15:19:16 -05:00
lib.rs chore: Happy New Year 2025 (#27509) 2025-01-09 15:19:16 -05:00
profiling.rs chore: Happy New Year 2025 (#27509) 2025-01-09 15:19:16 -05:00
README.md chore: cargo fmt - turn on group_imports=StdExternalCrate (#26646) 2025-01-09 15:19:15 -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);