-
Notifications
You must be signed in to change notification settings - Fork 30k
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
buffer: use v8 fast API calls for Buffer.byteLength with sequential one-byte strings #46616
Conversation
@anonrig, do we even need to go into native functions for short buffers? e.g. 1 byte? |
In this context: One byte refers to buffers with one byte string representations such as Ascii text. Using native calls will always be faster. "This is the way" - Mandalorian |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(re-approving to make sure the github bot is happy)
Commit Queue failed- Loading data for nodejs/node/pull/46616 ✔ Done loading data for nodejs/node/pull/46616 ----------------------------------- PR info ------------------------------------ Title buffer: use v8 fast API calls for Buffer.byteLength with sequential one-byte strings (#46616) Author Joyee Cheung (@joyeecheung) Branch joyeecheung:byte-length-one-byte -> nodejs:main Labels c++, lib / src, author ready, needs-ci Commits 5 - src: add SetFastMethodNoSideEffect() - benchmark: split Buffer.byteLength benchmark - buffer: use v8 fast API calls for Buffer.byteLength with sequential o… - fixup! buffer: use v8 fast API calls for Buffer.byteLength with seque… - fixup! benchmark: split Buffer.byteLength benchmark Committers 2 - Joyee Cheung - GitHub PR-URL: https://github.com/nodejs/node/pull/46616 Reviewed-By: Anna Henningsen Reviewed-By: Robert Nagy Reviewed-By: Yagiz Nizipli Reviewed-By: James M Snell ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/46616 Reviewed-By: Anna Henningsen Reviewed-By: Robert Nagy Reviewed-By: Yagiz Nizipli Reviewed-By: James M Snell -------------------------------------------------------------------------------- ℹ This PR was created on Sat, 11 Feb 2023 18:32:19 GMT ✔ Approvals: 4 ✔ - Anna Henningsen (@addaleax): https://github.com/nodejs/node/pull/46616#pullrequestreview-1295966149 ✔ - Robert Nagy (@ronag) (TSC): https://github.com/nodejs/node/pull/46616#pullrequestreview-1296865088 ✔ - Yagiz Nizipli (@anonrig): https://github.com/nodejs/node/pull/46616#pullrequestreview-1296774718 ✔ - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/46616#pullrequestreview-1304930817 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2023-02-20T10:26:36Z: https://ci.nodejs.org/job/node-test-pull-request/49775/ - Querying data for job/node-test-pull-request/49775/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ No git cherry-pick in progress ✔ No git am in progress ✔ No git rebase in progress -------------------------------------------------------------------------------- - Bringing origin/main up to date... From https://github.com/nodejs/node * branch main -> FETCH_HEAD ✔ origin/main is now up-to-date - Downloading patch for 46616 From https://github.com/nodejs/node * branch refs/pull/46616/merge -> FETCH_HEAD ✔ Fetched commits as b85b5ba10cd7..955cc5215476 -------------------------------------------------------------------------------- Auto-merging src/util.h [main 72bc87f801] src: add SetFastMethodNoSideEffect() Author: Joyee Cheung Date: Sat Feb 11 17:47:46 2023 +0100 3 files changed, 29 insertions(+), 2 deletions(-) [main 63a2cfe78e] benchmark: split Buffer.byteLength benchmark Author: Joyee Cheung Date: Sat Feb 11 17:48:17 2023 +0100 3 files changed, 62 insertions(+), 49 deletions(-) create mode 100644 benchmark/buffers/buffer-bytelength-buffer.js create mode 100644 benchmark/buffers/buffer-bytelength-string.js delete mode 100644 benchmark/buffers/buffer-bytelength.js Auto-merging src/node_external_reference.h [main ce060a1e41] buffer: use v8 fast API calls for Buffer.byteLength with sequential one-byte strings Author: Joyee Cheung Date: Sat Feb 11 17:49:32 2023 +0100 2 files changed, 28 insertions(+), 3 deletions(-) [main e2f3d9f5fb] fixup! buffer: use v8 fast API calls for Buffer.byteLength with sequential one-byte strings Author: Joyee Cheung Date: Mon Feb 13 16:57:01 2023 +0100 1 file changed, 1 insertion(+), 1 deletion(-) [main 24e347e7f3] fixup! benchmark: split Buffer.byteLength benchmark Author: Joyee Cheung Date: Sun Feb 19 21:53:12 2023 +0100 1 file changed, 1 insertion(+), 1 deletion(-) ✔ Patches applied There are 5 commits in the PR. Attempting autorebase. Rebasing (2/8)https://github.com/nodejs/node/actions/runs/4228422835 |
PR-URL: nodejs#46616 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]>
Use v8 fast API calls for Buffer.byteLength with sequential one-byte strings. PR-URL: nodejs#46616 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]>
955cc52
to
ee1ce18
Compare
Landed in 55dd283...ee1ce18 |
PR-URL: #46616 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]>
Use v8 fast API calls for Buffer.byteLength with sequential one-byte strings. PR-URL: #46616 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #46616 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]>
Use v8 fast API calls for Buffer.byteLength with sequential one-byte strings. PR-URL: #46616 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]>
This is blocked by #45788 |
PR-URL: #46616 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]>
Depends on #46619
From a local run: I am a bit surprised by the last few numbers, theoretically there should be no difference for them. Curious about what the benchmark CI would show.