1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00
denoland-deno/ext
Marcos Casagrande ceecd8c495
perf(ext/web): optimize structuredClone without transferables (#20730)
This PR optimizes `structuredClone` when it's called without
transferables.

### Benchmarks

**main**
```
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
----------------------------------------------------------------------------------- -----------------------------
structuredClone object              1.64 µs/iter     611,086.0     (1.58 µs … 1.84 µs)   1.66 µs   1.84 µs   1.84 µs
structuredClone transferables       2.82 µs/iter     354,281.4     (2.78 µs … 2.92 µs)   2.84 µs   2.92 µs   2.92 µs
```

**this PR**

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

structuredClone object                 1 µs/iter     998,383.5    (971.28 ns … 1.2 µs)      1 µs    1.2 µs    1.2 µs
structuredClone transferables       2.82 µs/iter     355,087.5      (2.7 µs … 3.07 µs)   2.83 µs   3.07 µs   3.07 µs
```

```js
Deno.bench("structuredClone object", () => {
  structuredClone({ foo: "bar" });
});

Deno.bench("structuredClone transferables", () => {
  const buf = new Uint8Array([97]);
  structuredClone(buf, {
    transfer: [buf.buffer],
  });
});
```
2023-10-06 23:21:48 +02:00
..
broadcast_channel refactor: use deno_core::FeatureChecker for unstable checks (#20765) 2023-10-04 21:42:17 +02: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 fix(ext/formdata): support multiple headers in FormData (#20801) 2023-10-05 19:28:44 +02:00
ffi chore(ext/ffi): migrate from op -> op2 for ffi (#20509) 2023-10-05 15:35:21 +02:00
fs refactor: use deno_core::FeatureChecker for unstable checks (#20765) 2023-10-04 21:42:17 +02:00
http refactor: use deno_core::FeatureChecker for unstable checks (#20765) 2023-10-04 21:42:17 +02:00
io chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
kv refactor: use deno_core::FeatureChecker for unstable checks (#20765) 2023-10-04 21:42:17 +02:00
napi chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
net refactor: use deno_core::FeatureChecker for unstable checks (#20765) 2023-10-04 21:42:17 +02:00
node refactor: migrate ext/node/ops to op2 (#20805) 2023-10-06 00:16:36 +02:00
tls chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
url refactor: rewrite several extension ops to op2 (#20457) 2023-10-05 14:34:38 +02:00
web perf(ext/web): optimize structuredClone without transferables (#20730) 2023-10-06 23:21:48 +02:00
webidl chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
websocket refactor: rewrite websocket to use op2 macro (#20140) 2023-10-04 21:43:58 +00:00
webstorage chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00