buffer: optimize byteLength for short strings#54345
Merged
nodejs-github-bot merged 1 commit intonodejs:mainfrom Aug 14, 2024
Merged
buffer: optimize byteLength for short strings#54345nodejs-github-bot merged 1 commit intonodejs:mainfrom
nodejs-github-bot merged 1 commit intonodejs:mainfrom
Conversation
Member Author
55227cf to 6506c2a Compare Member Author
| @lemire couldn't utf8_length_from_latin1 do this? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@ ## main #54345 +/- ## ========================================== - Coverage 87.09% 87.09% -0.01% ========================================== Files 647 648 +1 Lines 181816 182234 +418 Branches 34884 34964 +80 ========================================== + Hits 158360 158717 +357 - Misses 16764 16791 +27 - Partials 6692 6726 +34
|
Member
Fair question. Please see simdutf/simdutf#499 |
lemire reviewed Aug 13, 2024
lemire approved these changes Aug 13, 2024
Member
| Long term, it could pay to make simdutf faster in these cases, because we have the runtime dispatching in place. But this PR, as is, should be fine. |
anonrig approved these changes Aug 13, 2024
6506c2a to a608ae1 Compare ronag added a commit to nxtedition/node that referenced this pull request Aug 13, 2024
a608ae1 to 110e88b Compare ronag added a commit to nxtedition/node that referenced this pull request Aug 13, 2024
110e88b to b97e1f1 Compare ronag added a commit to nxtedition/node that referenced this pull request Aug 13, 2024
b97e1f1 to 0fedfdb Compare ronag added a commit to nxtedition/node that referenced this pull request Aug 13, 2024
0fedfdb to 1d66f25 Compare ronag added a commit to nxtedition/node that referenced this pull request Aug 13, 2024
1d66f25 to 6e3ab46 Compare anonrig approved these changes Aug 13, 2024
Collaborator
ronag added a commit to nxtedition/node that referenced this pull request Aug 13, 2024
a9325a3 to dc6d0a4 Compare lemire approved these changes Aug 13, 2024
Collaborator
BridgeAR reviewed Aug 13, 2024
Comment on lines +769 to +779
| for (; i + 32 <= length; i += 32) { | ||
| uint64_t v; | ||
| memcpy(&v, input + i, 8); | ||
| answer += pop(v); | ||
| memcpy(&v, input + i + 8, 8); | ||
| answer += pop(v); | ||
| memcpy(&v, input + i + 16, 8); | ||
| answer += pop(v); | ||
| memcpy(&v, input + i + 24, 8); | ||
| answer += pop(v); | ||
| } |
Member
There was a problem hiding this comment.
Is this really improving the performance? I am surprised that unrolling the loop is beneficial compared to just the lines right afterwards. I would expect the compiler to optimize things like that.
Collaborator
Collaborator
dc6d0a4 to e204e9e Compare Collaborator
Collaborator
Collaborator
Collaborator
| Landed in 75d25bc |
RafaelGSS pushed a commit that referenced this pull request Aug 19, 2024
PR-URL: #54345 Reviewed-By: Daniel Lemire <daniel@lemire.me> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Merged
RafaelGSS pushed a commit that referenced this pull request Aug 21, 2024
PR-URL: #54345 Reviewed-By: Daniel Lemire <daniel@lemire.me> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
M2