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

src: simplify string_bytes with views #54876

Merged

Conversation

lemire
Copy link
Member

@lemire lemire commented Sep 10, 2024

This PR adopts the new string views for latin1/base64/hex encoding/decoding. It should avoid unnecessary copies when the string is not external.

Compared to node 22:

                                                                               confidence improvement   accuracy (*)           (**)          (***)
buffers/buffer-base64-decode-wrapped.js n=32 linesCount=524288 charsPerLine=76        ***    183.12 %  14.24%  15.70%  17.51%
buffers/buffer-base64-decode.js size=8388608 n=32                                     ***    281.40 %  15.47%  17.32%  19.59%
buffers/buffer-base64-encode.js n=32 len=67108864                                              2.75 %  17.37%  19.81% 112.76%
buffers/buffer-base64url-decode.js size=8388608 n=32                                  ***    287.36 % 119.32% 125.94% 134.24%
buffers/buffer-base64url-encode.js n=32 len=67108864                                    *     -8.55 %  17.66% 110.19% 113.26%

@lemire lemire requested a review from jasnell September 10, 2024 15:47
@nodejs-github-bot nodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Sep 10, 2024
@lemire lemire added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 10, 2024
@github-actions github-actions bot added request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Sep 10, 2024
Copy link
Contributor

Failed to start CI
   ⚠  No approving reviews found
   ℹ  request-ci label was added by a Collaborator after the last push event.
- Validating Jenkins credentials
✔  Jenkins credentials valid
- Starting PR CI job
✘  Failed to start PR CI: 400 Bad Request
https://github.com/nodejs/node/actions/runs/10796091540

Copy link

codecov bot commented Sep 10, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.90%. Comparing base (22ea302) to head (7336a55).
Report is 296 commits behind head on main.

Files with missing lines Patch % Lines
src/string_bytes.cc 92.30% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #54876      +/-   ##
==========================================
+ Coverage   87.89%   87.90%   +0.01%     
==========================================
  Files         651      651              
  Lines      183364   183345      -19     
  Branches    35714    35711       -3     
==========================================
+ Hits       161171   161177       +6     
+ Misses      15465    15447      -18     
+ Partials     6728     6721       -7     
Files with missing lines Coverage Δ
src/string_bytes.cc 67.66% <92.30%> (+3.71%) ⬆️

... and 18 files with indirect coverage changes

@lemire lemire requested a review from anonrig September 10, 2024 17:56
@lemire lemire added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 10, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 10, 2024
@nodejs-github-bot
Copy link
Collaborator

@RedYetiDev RedYetiDev removed the request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. label Sep 11, 2024
@anonrig anonrig added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. labels Sep 11, 2024
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Sep 12, 2024
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/54876
✔  Done loading data for nodejs/node/pull/54876
----------------------------------- PR info ------------------------------------
Title      src: simplify string_bytes with views (#54876)
Author     Daniel Lemire <[email protected]> (@lemire)
Branch     lemire:simplify_string_bytes_with_views -> nodejs:main
Labels     buffer, c++, author ready, needs-ci
Commits    2
 - src: simplify string_bytes with views
 - restore comment
Committers 1
 - Daniel Lemire <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/54876
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/54876
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Tue, 10 Sep 2024 15:47:07 GMT
   ✔  Approvals: 3
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/54876#pullrequestreview-2292998616
   ✔  - Yagiz Nizipli (@anonrig) (TSC): https://github.com/nodejs/node/pull/54876#pullrequestreview-2293295906
   ✔  - Minwoo Jung (@JungMinu): https://github.com/nodejs/node/pull/54876#pullrequestreview-2295625995
   ⚠  GitHub cannot link the author of 'src: simplify string_bytes with views' to their GitHub account.
   ⚠  Please suggest them to take a look at https://github.com/nodejs/node/blob/99b1ada/doc/guides/contributing/pull-requests.md#step-1-fork
   ⚠  GitHub cannot link the author of 'restore comment' to their GitHub account.
   ⚠  Please suggest them to take a look at https://github.com/nodejs/node/blob/99b1ada/doc/guides/contributing/pull-requests.md#step-1-fork
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2024-09-10T18:00:21Z: https://ci.nodejs.org/job/node-test-pull-request/62285/
- Querying data for job/node-test-pull-request/62285/
   ✔  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 54876
From https://github.com/nodejs/node
 * branch                  refs/pull/54876/merge -> FETCH_HEAD
✔  Fetched commits as e60caeebdab8..7336a55561ad
--------------------------------------------------------------------------------
[main 52405663d8] src: simplify string_bytes with views
 Author: Daniel Lemire <[email protected]>
 Date: Tue Sep 10 11:00:08 2024 -0400
 1 file changed, 27 insertions(+), 58 deletions(-)
[main 9a2cd1534d] restore comment
 Author: Daniel Lemire <[email protected]>
 Date: Tue Sep 10 11:06:02 2024 -0400
 1 file changed, 1 insertion(+), 1 deletion(-)
   ✔  Patches applied
There are 2 commits in the PR. Attempting autorebase.
Rebasing (2/4)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
src: simplify string_bytes with views

PR-URL: #54876
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>

[detached HEAD f4a3715621] src: simplify string_bytes with views
Author: Daniel Lemire <[email protected]>
Date: Tue Sep 10 11:00:08 2024 -0400
1 file changed, 27 insertions(+), 58 deletions(-)
Rebasing (3/4)
Rebasing (4/4)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
restore comment

PR-URL: #54876
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>

[detached HEAD 4ede2f3a91] restore comment
Author: Daniel Lemire <[email protected]>
Date: Tue Sep 10 11:06:02 2024 -0400
1 file changed, 1 insertion(+), 1 deletion(-)

Successfully rebased and updated refs/heads/main.

ℹ Add commit-queue-squash label to land the PR as one commit, or commit-queue-rebase to land as separate commits.

https://github.com/nodejs/node/actions/runs/10834390869

@anonrig
Copy link
Member

anonrig commented Sep 12, 2024

@lemire your git config doesn't include your github email address causing the commit-queue to fail. can you update your git config and rebase and force push to this branch?

@richardlau richardlau added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Sep 12, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 12, 2024
@nodejs-github-bot nodejs-github-bot merged commit 9f5977f into nodejs:main Sep 12, 2024
81 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 9f5977f

@lemire
Copy link
Member Author

lemire commented Sep 12, 2024

@anonrig Somehow it landed!!! ❤️

@lemire
Copy link
Member Author

lemire commented Sep 12, 2024

It would not have been possible without @LeszekSwirski.

RafaelGSS pushed a commit that referenced this pull request Sep 16, 2024
PR-URL: #54876
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Sep 16, 2024
@RafaelGSS
Copy link
Member

It needs a manual backport to v22.x-staging. See #54966 (comment).

@RafaelGSS RafaelGSS added the backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. label Sep 16, 2024
@targos targos added dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. and removed backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. labels Oct 5, 2024
louwers pushed a commit to louwers/node that referenced this pull request Nov 2, 2024
PR-URL: nodejs#54876
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
tpoisseau pushed a commit to tpoisseau/node that referenced this pull request Nov 21, 2024
PR-URL: nodejs#54876
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants