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(napi): optimize primitive napi functions #16163

Merged
merged 3 commits into from
Oct 7, 2022

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Oct 5, 2022

This optimization applies on napi_get_undefined, napi_get_null & napi_get_boolean.

Depends on denoland/rusty_v8#1082

# main

benchmark               time (avg)             (min … max)       p75       p99      p995
---------------------------------------------------------- -----------------------------
warmup              482.55 ps/iter   (462.5 ps … 15.67 ns)    475 ps    525 ps  829.1 ps
napi_get_undefined   25.07 ns/iter   (24.03 ns … 36.87 ns)  25.37 ns  27.09 ns  34.85 ns
# This patch

benchmark               time (avg)             (min … max)       p75       p99      p995
---------------------------------------------------------- -----------------------------
warmup              484.78 ps/iter    (462.5 ps … 14.4 ns)    475 ps  554.1 ps  583.3 ps
napi_get_undefined   15.52 ns/iter   (15.35 ns … 22.14 ns)  15.41 ns  17.18 ns  20.02 ns

@littledivy littledivy marked this pull request as draft October 5, 2022 14:33
@littledivy littledivy marked this pull request as ready for review October 7, 2022 05:01
@littledivy littledivy closed this Oct 7, 2022
@littledivy littledivy reopened this Oct 7, 2022
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, I upgraded rusty_v8 and forgot to open a PR 🤦 oh I did open a PR and you merged it 🤣

@littledivy littledivy merged commit e136bd8 into denoland:main Oct 7, 2022
bartlomieju pushed a commit that referenced this pull request Oct 17, 2022
This optimization applies on `napi_get_undefined`, `napi_get_null` &
`napi_get_boolean`.

```
# main

benchmark               time (avg)             (min … max)       p75       p99      p995
---------------------------------------------------------- -----------------------------
warmup              482.55 ps/iter   (462.5 ps … 15.67 ns)    475 ps    525 ps  829.1 ps
napi_get_undefined   25.07 ns/iter   (24.03 ns … 36.87 ns)  25.37 ns  27.09 ns  34.85 ns
```

```
# This patch

benchmark               time (avg)             (min … max)       p75       p99      p995
---------------------------------------------------------- -----------------------------
warmup              484.78 ps/iter    (462.5 ps … 14.4 ns)    475 ps  554.1 ps  583.3 ps
napi_get_undefined   15.52 ns/iter   (15.35 ns … 22.14 ns)  15.41 ns  17.18 ns  20.02 ns
```
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.

None yet

2 participants