Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(ext/event): always set timeStamp to 0 #20191

Merged
merged 4 commits into from
Aug 20, 2023

Conversation

bartlomieju
Copy link
Member

@bartlomieju bartlomieju commented Aug 17, 2023

Deno.bench(function eventNew() {
  new Event("foo");
});

main

./target/release/deno bench event_bench.js
cpu: Apple M1 Max
runtime: deno 1.36.1 (aarch64-apple-darwin)

file:///Users/ib/dev/deno/event_bench.js
benchmark      time (avg)        iter/s             (min … max)       p75       p99      p995
--------------------------------------------------------------- -----------------------------
eventNew       36.43 ns/iter  27,451,874.9   (35.15 ns … 46.98 ns)  37.68 ns   40.7 ns  41.69 ns

this PR

./target/release/deno bench event_bench.js
cpu: Apple M1 Max
runtime: deno 1.36.1 (aarch64-apple-darwin)

file:///Users/ib/dev/deno/event_bench.js
benchmark      time (avg)        iter/s             (min … max)       p75       p99      p995
--------------------------------------------------------------- -----------------------------
eventNew       13.71 ns/iter  72,958,970.0   (12.85 ns … 31.79 ns)  15.11 ns  16.49 ns   17.5 ns

Towards #20167

@littledivy
Copy link
Member

We can remove [_skipInternalInit] option from Event constructor, if we always set timestamp to 0.

Copy link
Member

@lucacasonato lucacasonato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bartlomieju
Copy link
Member Author

Opened denoland/manual#718

@bartlomieju bartlomieju enabled auto-merge (squash) August 20, 2023 09:34
@bartlomieju bartlomieju merged commit 32bbba3 into denoland:main Aug 20, 2023
12 checks passed
@bartlomieju bartlomieju deleted the event_timestamp branch August 20, 2023 10:06
littledivy pushed a commit to littledivy/deno that referenced this pull request Aug 21, 2023
```js
Deno.bench(function eventNew() {
  new Event("foo");
});
```

<b>main</b>
```
./target/release/deno bench event_bench.js
cpu: Apple M1 Max
runtime: deno 1.36.1 (aarch64-apple-darwin)

file:///Users/ib/dev/deno/event_bench.js
benchmark      time (avg)        iter/s             (min … max)       p75       p99      p995
--------------------------------------------------------------- -----------------------------
eventNew       36.43 ns/iter  27,451,874.9   (35.15 ns … 46.98 ns)  37.68 ns   40.7 ns  41.69 ns

```

<b>this PR</b>
```
./target/release/deno bench event_bench.js
cpu: Apple M1 Max
runtime: deno 1.36.1 (aarch64-apple-darwin)

file:///Users/ib/dev/deno/event_bench.js
benchmark      time (avg)        iter/s             (min … max)       p75       p99      p995
--------------------------------------------------------------- -----------------------------
eventNew       13.71 ns/iter  72,958,970.0   (12.85 ns … 31.79 ns)  15.11 ns  16.49 ns   17.5 ns

```

Towards denoland#20167
littledivy pushed a commit that referenced this pull request Aug 21, 2023
```js
Deno.bench(function eventNew() {
  new Event("foo");
});
```

<b>main</b>
```
./target/release/deno bench event_bench.js
cpu: Apple M1 Max
runtime: deno 1.36.1 (aarch64-apple-darwin)

file:///Users/ib/dev/deno/event_bench.js
benchmark      time (avg)        iter/s             (min … max)       p75       p99      p995
--------------------------------------------------------------- -----------------------------
eventNew       36.43 ns/iter  27,451,874.9   (35.15 ns … 46.98 ns)  37.68 ns   40.7 ns  41.69 ns

```

<b>this PR</b>
```
./target/release/deno bench event_bench.js
cpu: Apple M1 Max
runtime: deno 1.36.1 (aarch64-apple-darwin)

file:///Users/ib/dev/deno/event_bench.js
benchmark      time (avg)        iter/s             (min … max)       p75       p99      p995
--------------------------------------------------------------- -----------------------------
eventNew       13.71 ns/iter  72,958,970.0   (12.85 ns … 31.79 ns)  15.11 ns  16.49 ns   17.5 ns

```

Towards #20167
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants