0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-02 20:55:35 -05:00
denoland-deno/ext
Marcos Casagrande de25c81fd0
perf(ext/web): optimize DOMException (#20715)
This PR optimizes `DOMException` constructor increasing performance of
all Web APIs that throw a `DOMException` (ie: `AbortSignal`)

**main**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.37.1 (x86_64-unknown-linux-gnu)

new DOMException()            9.66 µs/iter     103,476.8   (8.47 µs … 942.71 µs)   9.62 µs  11.29 µs  14.04 µs
abort writeTextFileSync      16.45 µs/iter      60,775.5    (13.65 µs … 1.33 ms)  16.39 µs  20.59 µs  24.12 µs
abort readFile               16.25 µs/iter      61,542.2  (15.12 µs … 621.14 µs)  16.18 µs  19.59 µs  22.33 µs
```

**this PR**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.37.1 (x86_64-unknown-linux-gnu)

benchmark                    time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------------- -----------------------------
new DOMException()            2.37 µs/iter     421,657.0     (2.33 µs … 2.58 µs)   2.37 µs   2.58 µs   2.58 µs
abort writeTextFileSync        7.1 µs/iter     140,760.1     (6.94 µs … 7.68 µs)   7.13 µs   7.68 µs   7.68 µs
abort readFile                5.48 µs/iter     182,648.2      (5.3 µs … 5.69 µs)   5.56 µs   5.69 µs   5.69 µ
```

```js
Deno.bench("new DOMException()", () => {
  new DOMException();
});

Deno.bench("abort writeTextFileSync", () => {
  const ac = new AbortController();
  ac.abort();
  try {
    Deno.writeTextFileSync("/tmp/out", "x", { signal: ac.signal });
  } catch {}
});

Deno.bench("abort readFile", async () => {
  const ac = new AbortController();
  ac.abort();
  try {
    await Deno.readFile("/tmp/out", { signal: ac.signal });
  } catch {}
});
```
2023-10-02 02:18:34 +02:00
..
broadcast_channel chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
cache chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
console chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
crypto chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
fetch chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
ffi chore(ext/ffi): migrate part of FFI to op2 (#20699) 2023-09-27 07:54:43 -06:00
fs chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
http chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
io chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
kv fix(ext/kv): send queue wake messages accross different kv instances (#20465) 2023-09-29 11:40:36 -07:00
napi chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
net chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
node perf(node): use faster utf8 byte length in Buffer#from (#20746) 2023-09-30 20:04:40 +05:30
tls chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
url chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
web perf(ext/web): optimize DOMException (#20715) 2023-10-02 02:18:34 +02:00
webidl chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
websocket chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
webstorage chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00