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

fs: add fast api for InternalModuleStat #51344

Merged

Conversation

anonrig
Copy link
Member

@anonrig anonrig commented Jan 2, 2024

Adds V8 Fast API to InternalModuleStat

@anonrig anonrig added the performance Issues and PRs related to the performance of Node.js. label Jan 2, 2024
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders

@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 related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jan 2, 2024
src/node_file.cc Outdated
Comment on lines 1065 to 1058
if (UNLIKELY(!env->permission()->is_granted(
permission::PermissionScope::kFileSystemRead, path))) {
options.fallback = true;
return -1;
}
Copy link
Member

Choose a reason for hiding this comment

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

Just thinking about this, if this is true, it will:

  • ignore the value -1.
  • re-run InternalModuleStat but in the slower version.
  • throw error since the permission is not granted.

I don't know if worthy but maybe one test just to ensure this behavior, maybe a loop and then pass a value that is not allowed.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a test (6 months later)

@H4ad
Copy link
Member

H4ad commented Jan 3, 2024

Error: --- stderr ---
npm WARN cli npm v10.2.4 does not support Node.js v22.0.0-pre. This version of npm supports the following node versions: `^18.17.0 || >=20.5.0`. You can find the latest version at [https://nodejs.org/.](https://nodejs.org/)
npm ERR! code MODULE_NOT_FOUND
npm ERR! path /home/runner/work/node/node/deps/npm/node_modules/walk-up-path/package.json
npm ERR! Cannot find module '/home/runner/work/node/node/deps/npm/node_modules/walk-up-path/dist/cjs/index.js'

Failing because of the Node version: https://github.com/nodejs/node/actions/runs/7390448695/job/20105393172?pr=51344#step:6:5719

Who we should ping to solve this kind of issue?

@anonrig
Copy link
Member Author

anonrig commented Jan 3, 2024

Error: --- stderr ---
npm WARN cli npm v10.2.4 does not support Node.js v22.0.0-pre. This version of npm supports the following node versions: `^18.17.0 || >=20.5.0`. You can find the latest version at [https://nodejs.org/.](https://nodejs.org/)
npm ERR! code MODULE_NOT_FOUND
npm ERR! path /home/runner/work/node/node/deps/npm/node_modules/walk-up-path/package.json
npm ERR! Cannot find module '/home/runner/work/node/node/deps/npm/node_modules/walk-up-path/dist/cjs/index.js'

Failing because of the Node version: https://github.com/nodejs/node/actions/runs/7390448695/job/20105393172?pr=51344#step:6:5719

Who we should ping to solve this kind of issue?

cc @nodejs/build @nodejs/npm Any suggestions on how to fix the error?

@wraithgar
Copy link

wraithgar commented Jan 3, 2024

There are two separate items in that log. First is a warning that will always show up when you're using a prerelease version of node. This is intentional to remind folks that they're in an unsupported prerelease version of node. npm still will install just fine, the part of npm that prevents itself from being installed globally in an unsupported node version throws a different exception and allows prereleases in its semver check against npm's engines field.

The second error has to do with a missing file that is being required. As to why that file is missing, that's another mystery. It's definitely in the tarball of the published module, and in source control.

@targos
Copy link
Member

targos commented Jan 3, 2024

The error must be related to the changes made in this PR. In other words, there's a bug in the implementation.

@aduh95
Copy link
Contributor

aduh95 commented May 11, 2024

This needs a rebase.

@anonrig anonrig force-pushed the fast-api-internal-module-stat branch from 11cea33 to 3f32a24 Compare June 13, 2024 21:59
@nodejs-github-bot
Copy link
Collaborator

@anonrig anonrig force-pushed the fast-api-internal-module-stat branch from 3f32a24 to 9b6a9f8 Compare June 13, 2024 22:13
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@anonrig anonrig force-pushed the fast-api-internal-module-stat branch from 9b6a9f8 to 1a71169 Compare June 14, 2024 13:22
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

is this improving startup time in any way?

@anonrig
Copy link
Member Author

anonrig commented Jun 16, 2024

is this improving startup time in any way?

I don't know, but better ask our friend "benchmark ci": https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1570/

@anonrig
Copy link
Member Author

anonrig commented Jun 16, 2024

@mcollina

misc/startup-cli-version.js count=30 cli='deps/corepack/dist/corepack.js'                        ***      0.14 %       ±0.08% ±0.11% ±0.14%
misc/startup-cli-version.js count=30 cli='deps/npm/bin/npm-cli.js'                                        0.07 %       ±0.19% ±0.25% ±0.33%
misc/startup-cli-version.js count=30 cli='deps/npm/bin/npx-cli.js'                               ***      0.31 %       ±0.17% ±0.23% ±0.30%
misc/startup-cli-version.js count=30 cli='tools/node_modules/eslint/bin/eslint.js'               ***     -0.12 %       ±0.05% ±0.06% ±0.08%
misc/startup-core.js count=30 mode='process' script='benchmark/fixtures/require-builtins'          *     -0.45 %       ±0.36% ±0.48% ±0.62%
misc/startup-core.js count=30 mode='process' script='test/fixtures/semicolon'                             2.38 %       ±3.17% ±4.22% ±5.50%
misc/startup-core.js count=30 mode='process' script='test/fixtures/snapshot/typescript'          ***      0.55 %       ±0.05% ±0.06% ±0.08%
misc/startup-core.js count=30 mode='worker' script='benchmark/fixtures/require-builtins'                 -0.20 %       ±0.23% ±0.31% ±0.40%
misc/startup-core.js count=30 mode='worker' script='test/fixtures/semicolon'                              0.06 %       ±0.37% ±0.49% ±0.65%
misc/startup-core.js count=30 mode='worker' script='test/fixtures/snapshot/typescript'                    0.69 %       ±0.85% ±1.13% ±1.47%```

@anonrig anonrig added the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 16, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 16, 2024
@nodejs-github-bot nodejs-github-bot merged commit 1aa8a78 into nodejs:main Jun 16, 2024
51 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 1aa8a78

targos pushed a commit that referenced this pull request Jun 20, 2024
PR-URL: #51344
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
EliphazBouye pushed a commit to EliphazBouye/node that referenced this pull request Jun 20, 2024
PR-URL: nodejs#51344
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
bmeck pushed a commit to bmeck/node that referenced this pull request Jun 22, 2024
PR-URL: nodejs#51344
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Sign up for free to 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++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. performance Issues and PRs related to the performance of Node.js.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants