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 /core/examples/http_bench_json_ops.js | |
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 'core/examples/http_bench_json_ops.js')
-rw-r--r-- | core/examples/http_bench_json_ops.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/examples/http_bench_json_ops.js b/core/examples/http_bench_json_ops.js index 883ef1752..261d91559 100644 --- a/core/examples/http_bench_json_ops.js +++ b/core/examples/http_bench_json_ops.js @@ -2,6 +2,8 @@ // This is not a real HTTP server. We read blindly one time into 'requestBuf', // then write this fixed 'responseBuf'. The point of this benchmark is to // exercise the event loop in a simple yet semi-realistic way. +Deno.core.initializeAsyncOps(); + const requestBuf = new Uint8Array(64 * 1024); const responseBuf = new Uint8Array( "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n" @@ -16,7 +18,7 @@ function listen() { /** Accepts a connection, returns rid. */ function accept(serverRid) { - return Deno.core.opAsync("op_accept", serverRid); + return Deno.core.ops.op_accept(serverRid); } async function serve(rid) { |