diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2022-10-27 06:40:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-27 19:10:48 +0530 |
commit | 02187966c108fd50354c8de57bab443a5b262373 (patch) | |
tree | 8076ec580cef65797897303a6bb3866f74227bd3 /bench_util/js_runtime.rs | |
parent | bfd9912e1faa30a92472252b77878714e668a3d4 (diff) |
perf(core): generate inlined wrappers for async ops (#16428)
V8's JIT can do a better job knowing the argument count and also enable
fast call path (in future).
This also lets us call async ops without `opAsync`:
```js
const { ops } = Deno.core;
await ops.op_void_async();
```
this patch: 4405286 ops/sec
main: 3508771 ops/sec
Diffstat (limited to 'bench_util/js_runtime.rs')
-rw-r--r-- | bench_util/js_runtime.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bench_util/js_runtime.rs b/bench_util/js_runtime.rs index 06dd79fae..f87fa3b03 100644 --- a/bench_util/js_runtime.rs +++ b/bench_util/js_runtime.rs @@ -63,7 +63,6 @@ pub fn bench_js_sync_with( let code = v8::String::new(scope, looped_src.as_ref()).unwrap(); let script = v8::Script::compile(scope, code, None).unwrap(); - // Run once if profiling, otherwise regular bench loop if is_profiling() { script.run(scope).unwrap(); @@ -102,7 +101,9 @@ pub fn bench_js_async_with( }; let looped = loop_code(inner_iters, src); let src = looped.as_ref(); - + runtime + .execute_script("init", "Deno.core.initializeAsyncOps();") + .unwrap(); if is_profiling() { for _ in 0..opts.profiling_outer { tokio_runtime.block_on(inner_async(src, &mut runtime)); |