Skip to content

Conversation

@anonrig
Copy link
Member

@anonriganonrig commented Dec 3, 2023

This PR moves all getValidatedFd calls to C++. Improves error path performance by ~17-42%.

Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1482/

@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Dec 3, 2023
@targos
Copy link
Member

It is semver-major, and would be a very disruptive change, especially if it happens incrementally. It's been a general rule for a long time in Node.js that validation happens synchronously.

@targostargos added the semver-major PRs that contain breaking changes and should be released in the next major version. label Dec 3, 2023
Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm -1 for the reasons mentioned by @targos.

@tniessen
Copy link
Member

See also #49970, which is blocked on the same problem as far as I am aware.

@anonriganonrig changed the title fs: move validateFd to c++fs: validate fd for sync calls on c++Dec 3, 2023
@anonrig
Copy link
MemberAuthor

@mcollina@tniessen@targos I've updated the PR to remove server-major changes. We now validate only on sync call paths. This change will also allow us to move async function to C++ and potentially eliminate the usage of FSReqWrap so that we can throw the errors synchronously from C++.

Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@anonriganonrig removed the semver-major PRs that contain breaking changes and should be released in the next major version. label Dec 3, 2023
@anonriganonrig changed the title fs: validate fd for sync calls on c++fs: validate fd synchronously on c++Dec 5, 2023
@anonriganonrigforce-pushed the validate-fd branch 5 times, most recently from d406848 to 7935836CompareDecember 5, 2023 17:30
@anonrig
Copy link
MemberAuthor

cc @nodejs/fs @nodejs/cpp-reviewers

@anonriganonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 5, 2023
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 5, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@anonriganonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 12, 2023
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 12, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@anonriganonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 15, 2023
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 15, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@nodejs-github-bot
Copy link
Collaborator

@anonriganonrig added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 18, 2023
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 18, 2023
@nodejs-github-botnodejs-github-bot merged commit 65e70bf into nodejs:mainDec 18, 2023
@nodejs-github-bot
Copy link
Collaborator

Landed in 65e70bf

RafaelGSS pushed a commit that referenced this pull request Jan 2, 2024
@RafaelGSSRafaelGSS mentioned this pull request Jan 2, 2024
richardlau pushed a commit that referenced this pull request Mar 25, 2024
@richardlaurichardlau mentioned this pull request Mar 25, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++Issues and PRs that require attention from people who are familiar with C++.fsIssues and PRs related to the fs subsystem / file system.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@anonrig@targos@tniessen@nodejs-github-bot@mcollina@Qard@jasnell@joyeecheung@RafaelGSS