mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 15:06:54 -05:00
ceecd8c495
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], }); }); ``` |
||
---|---|---|
.. | ||
broadcast_channel | ||
cache | ||
console | ||
crypto | ||
fetch | ||
ffi | ||
fs | ||
http | ||
io | ||
kv | ||
napi | ||
net | ||
node | ||
tls | ||
url | ||
web | ||
webidl | ||
websocket | ||
webstorage |