1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00
denoland-deno/ext/web
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
..
benches refactor: update core extension api usage (#19952) 2023-07-31 18:19:15 +00:00
00_infra.js fix(core): Use safe primordials wrappers (#18687) 2023-04-14 22:23:28 +02:00
01_dom_exception.js perf(ext/web): optimize DOMException (#20715) 2023-10-02 02:18:34 +02:00
01_mimesniff.js perf: optimize RegExp usage in JS (#19364) 2023-06-05 10:52:40 +02:00
02_event.js perf(ext/event): always set timeStamp to 0 (#20191) 2023-08-20 10:02:47 +00:00
02_structured_clone.js fix(core): Use safe primordials wrappers (#18687) 2023-04-14 22:23:28 +02:00
02_timers.js feat: support import attributes (#20342) 2023-09-07 09:09:16 -04:00
03_abort_signal.js fix(ext/abort): trigger AbortSignal events in correct order (#20095) 2023-08-08 12:05:42 +02:00
04_global_interfaces.js refactor: rename InternalModuleLoader to ExtModuleLoader, use ext: scheme for snapshotted modules (#18041) 2023-03-08 12:44:54 +01:00
05_base64.js refactor(webidl): move prefix & context out of converters options bag (#18931) 2023-05-01 10:47:13 +00:00
06_streams.js feat(ext/web): use readableStreamDefaultReaderRead in resourceForReadableStream (#20622) 2023-09-23 14:55:28 +00:00
06_streams_types.d.ts chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
08_text_encoding.js refactor(webidl): move prefix & context out of converters options bag (#18931) 2023-05-01 10:47:13 +00:00
09_file.js feat(ext/web): Add name to Deno.customInspect of File objects (#20415) 2023-09-14 07:06:58 +02:00
10_filereader.js refactor(webidl): move prefix & context out of converters options bag (#18931) 2023-05-01 10:47:13 +00:00
12_location.js chore: fix typos (#19572) 2023-06-26 09:10:27 -04:00
13_message_port.js perf(ext/web): optimize structuredClone without transferables (#20730) 2023-10-06 23:21:48 +02:00
14_compression.js refactor(webidl): move prefix & context out of converters options bag (#18931) 2023-05-01 10:47:13 +00:00
15_performance.js refactor(webidl): move prefix & context out of converters options bag (#18931) 2023-05-01 10:47:13 +00:00
blob.rs refactor: rewrite several extension ops to op2 (#20457) 2023-10-05 14:34:38 +02:00
Cargo.toml chore: forward v1.37.1 release commit to main (#20706) 2023-09-27 09:13:48 +00:00
compression.rs refactor: rewrite several extension ops to op2 (#20457) 2023-10-05 14:34:38 +02:00
hr_timer_lock.rs chore: update to Rust 1.71 (#19822) 2023-07-13 15:16:24 -06:00
internal.d.ts perf(ext/node): Optimise Buffer string operations (#20158) 2023-09-07 14:41:16 -06:00
lib.deno_web.d.ts fix(dts): make globals available on globalThis (#19438) 2023-07-03 14:36:55 -04:00
lib.rs refactor: rewrite several extension ops to op2 (#20457) 2023-10-05 14:34:38 +02:00
message_port.rs refactor: rewrite more ops to op2 macro (#20478) 2023-09-14 23:05:18 +02:00
README.md Rename extensions/ directory to ext/ (#11643) 2021-08-11 12:27:05 +02:00
stream_resource.rs fix(ext/http): ensure that resources are closed when request is cancelled (#20641) 2023-09-25 17:23:55 +02:00
timers.rs refactor: rewrite several extension ops to op2 (#20457) 2023-10-05 14:34:38 +02:00

deno web

Op crate that implements Event, TextEncoder, TextDecoder and File API (https://w3c.github.io/FileAPI).

Testing for text encoding is done via WPT in cli/.