GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: add internal isArrayBufferDetached by anonrig · Pull Request #45568 · nodejs/node

Conversation

@anonrig

@anonrig anonrig commented Nov 21, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Follow up on #45512

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss, lin72h, and ExE-Boss reacted with thumbs up emoji
All reactions
  • 👍 3 reactions
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Nov 21, 2022
@anonrig anonrig mentioned this pull request Nov 21, 2022
util: add isArrayBufferDetached method #45512
Closed
@anonrig
anonrig force-pushed the util/is-array-buffer-detached branch 2 times, most recently from 7d64817 to dcee530 Compare November 21, 2022 23:40
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 21, 2022
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 21, 2022
@nodejs-github-bot

nodejs-github-bot commented Nov 21, 2022

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/48076/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

aduh95
aduh95 approved these changes Nov 21, 2022
View reviewed changes
@anonrig anonrig added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Nov 21, 2022
@anonrig
src: add internal isArrayBufferDetached
4d5d53b
@anonrig
anonrig force-pushed the util/is-array-buffer-detached branch from dcee530 to 4d5d53b Compare November 22, 2022 22:16
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 22, 2022
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 22, 2022
@nodejs-github-bot

nodejs-github-bot commented Nov 22, 2022

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/48106/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

RaisinTen
RaisinTen reviewed Nov 23, 2022
View reviewed changes
Comment thread lib/internal/util.js

function isArrayBufferDetached(value) {
if (ArrayBufferPrototypeGetByteLength(value) === 0) {
return _isArrayBufferDetached(value);

@RaisinTen RaisinTen Nov 23, 2022

Copy link
Copy Markdown
Member

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.

Crossing the JS-C++ boundary is gonna be slower than the current implementation although I'm not sure if this call in the zero length case is gonna be the primary bottleneck for any user code.

Did you consider implementing @jasnell's suggestion in #45512 (comment)? Seems like that approach would solve this problem without adding any performance overhead in any case.

One thing we might be able to do is add a hidden symbol to ArrayBuffer instances when we detach them in c++ land. Then we can have an isDetached check in js that checks the length and the presence of that symbol.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@anonrig anonrig Nov 23, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

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.

IMHO, that is the perfect solution for performance, but I believe it's too hacky to maintain in the long term. I can't think of a good/maintainable way to enforce attaching the hidden symbol as a rule.

If it's the consensus @jasnell thinks is the best way, I'll be happy to implement it regardless.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot

nodejs-github-bot commented Nov 23, 2022

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/48123/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

LiviaMedeiros
LiviaMedeiros approved these changes Nov 23, 2022
View reviewed changes

@LiviaMedeiros LiviaMedeiros left a comment

Copy link
Copy Markdown
Member

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.

LGTM with or without a nit.

Adding a test would also be nice.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread lib/internal/util.js
Comment on lines +566 to +570
if (ArrayBufferPrototypeGetByteLength(value) === 0) {
return _isArrayBufferDetached(value);
}

return false;

@LiviaMedeiros LiviaMedeiros Nov 23, 2022

Copy link
Copy Markdown
Member

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.

Nit: the flow might look semantically better like this

Suggested change
if (ArrayBufferPrototypeGetByteLength(value) === 0) {
return _isArrayBufferDetached(value);
}
return false;
if (ArrayBufferPrototypeGetByteLength(value) !== 0) {
return false;
}
return _isArrayBufferDetached(value);

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot mentioned this pull request Nov 24, 2022
CI Reliability 2022-11-24 nodejs/reliability#438
Open
16 tasks
@nodejs-github-bot

nodejs-github-bot commented Nov 24, 2022

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/48162/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Nov 25, 2022
CI Reliability 2022-11-25 nodejs/reliability#439
Open
CI Reliability 2022-11-26 nodejs/reliability#440
Open
CI Reliability 2022-11-27 nodejs/reliability#441
Open
@anonrig anonrig added the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 27, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 27, 2022
@nodejs-github-bot
nodejs-github-bot merged commit 9a8d82b into nodejs:main Nov 27, 2022
@nodejs-github-bot

nodejs-github-bot commented Nov 27, 2022

Copy link
Copy Markdown
Collaborator

Landed in 9a8d82b

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

targos pushed a commit that referenced this pull request Dec 12, 2022
@anonrig @targos
src: add internal isArrayBufferDetached
0bbb988
PR-URL: #45568
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: LiviaMedeiros <[email protected]>
@targos targos mentioned this pull request Dec 12, 2022
v19.3.0 release proposal #45831
Merged
targos pushed a commit that referenced this pull request Dec 13, 2022
@anonrig @targos
src: add internal isArrayBufferDetached
349b4f8
PR-URL: #45568
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: LiviaMedeiros <[email protected]>
@danielleadams danielleadams mentioned this pull request Dec 30, 2022
v18.13.0 release proposal #46025
Merged
danielleadams pushed a commit that referenced this pull request Dec 30, 2022
@anonrig @danielleadams
src: add internal isArrayBufferDetached
58d7956
PR-URL: #45568
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: LiviaMedeiros <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 3, 2023
@anonrig @danielleadams
src: add internal isArrayBufferDetached
ae61740
PR-URL: #45568
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: LiviaMedeiros <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 5, 2023
@anonrig @danielleadams
src: add internal isArrayBufferDetached
819f786
PR-URL: #45568
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: LiviaMedeiros <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@RaisinTen RaisinTen RaisinTen left review comments
@aduh95 aduh95 aduh95 approved these changes
@LiviaMedeiros LiviaMedeiros LiviaMedeiros approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@anonrig @nodejs-github-bot @aduh95 @RaisinTen @LiviaMedeiros
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.