1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-28 16:20:57 -05:00
denoland-deno/cli
Marcos Casagrande 3b4efd339d perf(ext/event): optimize Event constructor (#20181)
This PR optimizes `Event` constructor

- ~Added a fast path for empty `eventInitDict`~ Removed `EventInit`
dictionary converter
- Don't make `isTrusted` a
[LegacyUnforgeable](https://webidl.spec.whatwg.org/#LegacyUnforgeable)
property. Doing so makes it non-spec compliant but calling
`Object/Reflect.defineProperty` on the constructor is a big bottleneck.
Node did the same a few months ago
https://github.com/nodejs/node/pull/46974. In my opinion, the
performance gains are worth deviating from the spec for a
browser-related property.

**This PR**

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

benchmark                      time (avg)        iter/s             (min … max)       p75       p99      p995
------------------------------------------------------------------------------- -----------------------------
event constructor no init      36.69 ns/iter  27,257,504.6   (33.36 ns … 42.45 ns)  37.71 ns  39.61 ns  40.07 ns
event constructor               36.7 ns/iter  27,246,776.6   (33.35 ns … 56.03 ns)  37.73 ns  40.14 ns  41.74 ns
```

**main**

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

benchmark                      time (avg)        iter/s             (min … max)       p75       p99      p995
------------------------------------------------------------------------------- -----------------------------
event constructor no init     380.48 ns/iter   2,628,275.8 (366.66 ns … 399.39 ns) 384.58 ns 398.27 ns 399.39 ns
event constructor             480.33 ns/iter   2,081,882.6 (466.67 ns … 503.47 ns) 484.27 ns 501.28 ns 503.47 ns
```

```js
Deno.bench("event constructor no init", () => {
  const event = new Event("foo");
});

Deno.bench("event constructor", () => {
  const event = new Event("foo", { bubbles: true, cancelable: false });
});
```

towards https://github.com/denoland/deno/issues/20167
2023-08-21 18:23:27 +05:30
..
args fix(cli) error gracefully when script arg is not present and --v8-flags is present in deno run (#20145) 2023-08-21 18:23:27 +05:30
bench chore: upgrade to dprint 0.39 (#19768) 2023-07-08 18:34:08 +00:00
cache refactor: use deno_cache_dir crate (#20092) 2023-08-08 14:23:02 +00:00
js fix(test): handle ASCII escape chars in test name (#20081) 2023-08-10 01:40:34 +02:00
lsp refactor(cli): move snapshot_from_lockfile function to deno_npm (#20024) 2023-08-08 10:07:29 -07:00
napi 1.36.1 (#20221) 2023-08-21 18:08:38 +05:30
npm feat(ext/node): eagerly bootstrap node (#20153) 2023-08-21 18:23:27 +05:30
ops build: allow disabling snapshots for dev (#20048) 2023-08-06 01:47:15 +02:00
schemas feat(unstable): rename deno_modules to vendor (#20065) 2023-08-06 21:56:56 -04:00
standalone feat(ext/node): eagerly bootstrap node (#20153) 2023-08-21 18:23:27 +05:30
tests perf(ext/event): optimize Event constructor (#20181) 2023-08-21 18:23:27 +05:30
tools feat(ext/node): eagerly bootstrap node (#20153) 2023-08-21 18:23:27 +05:30
tsc feat(permissions): add "--deny-*" flags (#19070) 2023-08-03 13:19:19 +02:00
util feat(unstable): rename deno_modules to vendor (#20065) 2023-08-06 21:56:56 -04:00
auth_tokens.rs chore: upgrade to Rust 1.67 (#17548) 2023-01-27 10:43:16 -05:00
build.rs build: remove redundant rerun-if-changed for compiler snapshot (#20094) 2023-08-08 09:21:54 +02:00
Cargo.toml 1.36.1 (#20221) 2023-08-21 18:08:38 +05:30
deno.ico fix(cli): add icon and metadata to deno.exe on Windows (#6693) 2020-07-15 21:54:38 +02:00
deno_std.rs 1.36.1 (#20221) 2023-08-21 18:08:38 +05:30
emit.rs refactor(lsp): move config file related code to config.rs (#19790) 2023-07-10 21:45:09 +00:00
errors.rs feat: TypeScript 5.0.2 (except decorators) (#18294) 2023-03-21 15:46:40 +00:00
factory.rs feat(ext/node): eagerly bootstrap node (#20153) 2023-08-21 18:23:27 +05:30
file_fetcher.rs refactor: use deno_cache_dir crate (#20092) 2023-08-08 14:23:02 +00:00
graph_util.rs feat(unstable): optional deno_modules directory (#19977) 2023-08-02 00:49:09 +00:00
http_util.rs feat(unstable): add more options to Deno.createHttpClient (#17385) 2023-05-21 03:43:54 +02:00
js.rs build: allow disabling snapshots for dev (#20048) 2023-08-06 01:47:15 +02:00
main.rs fix(lint): allow to use --rules with --rules-tags (#19754) 2023-07-25 17:24:06 -04:00
module_loader.rs chore: rename some helpers on the Fs trait (#20097) 2023-08-08 16:28:18 -04:00
node.rs chore: rename some helpers on the Fs trait (#20097) 2023-08-08 16:28:18 -04:00
README.md docs(cli): do not need gen doc for cli (#17260) 2023-01-04 13:19:58 +01:00
resolver.rs feat: top level package.json install when node_modules dir is explicitly opted into (#19233) 2023-05-23 18:51:48 -04:00
version.rs refactor: make version and user_agent &'static str (#18400) 2023-03-23 23:27:58 +01:00
worker.rs feat(ext/node): eagerly bootstrap node (#20153) 2023-08-21 18:23:27 +05:30

Deno CLI Crate

crates

This provides the actual deno executable and the user-facing APIs.

The deno crate uses the deno_core to provide the executable.