-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: Fix inefficient usage of v8_inspector::StringView #52372
Open
szuend
wants to merge
3
commits into
nodejs:main
Choose a base branch
from
szuend:fix-inspector-string-view-usage
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
nodejs-github-bot
added
c++
Issues and PRs that require attention from people who are familiar with C++.
lib / src
Issues and PRs related to general changes in the lib or src directory.
needs-ci
PRs that need a full CI run.
labels
Apr 5, 2024
szuend
force-pushed
the
fix-inspector-string-view-usage
branch
from
April 5, 2024 05:43
0d43fab
to
a4087c9
Compare
addaleax
approved these changes
Apr 5, 2024
addaleax
approved these changes
Apr 8, 2024
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
Apr 8, 2024
Failed to start CI- Validating Jenkins credentials ✘ Jenkins credentials invalidhttps://github.com/nodejs/node/actions/runs/8605010252 |
@addaleax Anything I need to address from my side for the failed CI run? |
panva
added
request-ci
Add this label to start a Jenkins CI on a PR.
and removed
request-ci-failed
An error occurred while starting CI via request-ci label, and manual interventon is needed.
labels
Apr 9, 2024
addaleax
added
commit-queue
Add this label to land a pull request using GitHub Actions.
and removed
commit-queue
Add this label to land a pull request using GitHub Actions.
labels
Apr 10, 2024
github-actions
bot
removed
the
request-ci
Add this label to start a Jenkins CI on a PR.
label
Apr 10, 2024
I'm not too familiar with the node CI. Are the failing tests from the two CI runs generally known to be flaky or should I investigate? |
github-actions
bot
removed
the
request-ci
Add this label to start a Jenkins CI on a PR.
label
Apr 16, 2024
v8_inspector::StringView can either be one-byte or two-byte strings. Node has currently two places where it's unconditionally assumed that it's a two-byte StringView. This requires the upstream V8 inspector to unnecessarily create a copy of the string: https://source.chromium.org/chromium/chromium/src/+/main:v8/src/inspector/v8-inspector-session-impl.cc;l=192-199;drc=05bacd38e7a31e92afe0fd66081dfa2cc03b934a This is particularly slow, especially for large CDP messages, as the serialized JSON is iterated 8-bit char by 8-bit char and each one widened to a 16-bit char. This PR introduces a small helper that correctly converts a StringView to a v8::String instance honoring the "is8Bit" flag. This allows upstream V8 to remove the unnecessary widening copy.
szuend
force-pushed
the
fix-inspector-string-view-usage
branch
from
April 22, 2024 07:31
66345c0
to
f79c3cb
Compare
Rebased the PR after #51783 has landed. FYI @joyeecheung |
joyeecheung
approved these changes
Apr 22, 2024
github-actions
bot
removed
the
request-ci
Add this label to start a Jenkins CI on a PR.
label
Apr 22, 2024
jasnell
approved these changes
Apr 27, 2024
github-actions
bot
removed
the
request-ci
Add this label to start a Jenkins CI on a PR.
label
May 27, 2024
JungMinu
approved these changes
Aug 8, 2024
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.
v8_inspector::StringView can either be one-byte or two-byte strings. Node has currently two places where it's unconditionally assumed that it's a two-byte StringView.
This requires the upstream V8 inspector to unnecessarily create a copy of the string:
https://source.chromium.org/chromium/chromium/src/+/main:v8/src/inspector/v8-inspector-session-impl.cc;l=192-199;drc=05bacd38e7a31e92afe0fd66081dfa2cc03b934a
This is particularly slow, especially for large CDP messages, as the serialized JSON is iterated 8-bit char by 8-bit char and each one widened to a 16-bit char.
This PR introduces a small helper that correctly converts a StringView to a v8::String instance honoring the "is8Bit" flag. This allows upstream V8 to remove the unnecessary widening copy.
Tested locally with removing the widening copy in v8-inspector-session-impl.cc: Without the PR lots of tests will fail. But I'm happy to add unit tests for the
JSBindingsConnection
/V8ProfilerConnection
if desired.