1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00
denoland-deno/bench_util
denobot 5be97b7584
1.33.4 (#19180)
Bumped versions for 1.33.4

Please ensure:
- [x] Target branch is correct (`vX.XX` if a patch release, `main` if
minor)
- [x] Crate versions are bumped correctly
- [x] deno_std version is incremented in the code (see
`cli/deno_std.rs`)
- [x] Releases.md is updated correctly (think relevancy and remove
reverts)

To make edits to this PR:
```shell
git fetch upstream release_1_33.4 && git checkout -b release_1_33.4 upstream/release_1_33.4
```

cc @levex

---------

Co-authored-by: levex <levex@users.noreply.github.com>
Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-05-18 18:21:18 +02:00
..
benches Reland "perf(core): preserve ops between snapshots (#18080)" (#18272) 2023-03-18 18:30:04 -04:00
Cargo.toml 1.33.4 (#19180) 2023-05-18 18:21:18 +02:00
js_runtime.rs fix(core): allow esm extensions not included in snapshot (#18980) 2023-05-04 16:19:31 +02:00
lib.rs chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
profiling.rs chore: use rustfmt imports_granularity option (#17421) 2023-01-14 23:18:58 -05:00
README.md perf(ops): Monomorphic sync op calls (#15337) 2022-08-11 15:56:56 +02:00

Benching utility for deno_core op system

Example:

use deno_bench_util::bench_or_profile;
use deno_bench_util::bencher::{benchmark_group, Bencher};
use deno_bench_util::bench_js_sync};

use deno_core::op_sync;
use deno_core::serialize_op_result;
use deno_core::Extension;
use deno_core::JsRuntime;
use deno_core::Op;
use deno_core::OpState;

fn setup() -> Vec<Extension> {
  let custom_ext = Extension::builder()
    .ops(vec![
      ("op_nop", |state, _| {
        Op::Sync(serialize_op_result(Ok(9), state))
      }),
    ])
    .build();
  
  vec![
    // deno_{ext}::init(...),
    custom_ext,
  ]
}

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);