Skip to content

tools: add lint rule for unread benchmark n - #66807

Open
GroophyLifefor wants to merge 1 commit into
nodejs:mainfrom
GroophyLifefor:tools-benchmark-n-config
Open

GroophyLifefor wants to merge 1 commit into
nodejs:mainfrom
GroophyLifefor:tools-benchmark-n-config

Conversation

@GroophyLifefor

Copy link
Copy Markdown

Adds a node-core/benchmark-n-config lint rule: if a benchmark declares n in its configs, main() must read it.

This would have caught #59872, which renamed num to n but left main({ num: n }), so n was undefined (fixed in #62084).

It also found async_hooks/async-resource-vs-destroy.js, where n: [1e6] was never read; removed.

Refs: nodejs/performance#187

If a benchmark declares `n` in its configs, main() must read it.
nodejs#59872 renamed a config key from `num` to `n` but left
`{ num: n }` in main(), so `n` resolved to undefined and the
benchmark silently reported near-zero results until nodejs#62084 fixed
it.

The rule also found `async_hooks/async-resource-vs-destroy.js`,
which has declared `n: [1e6]` since it was added but never read
it. Remove the unused key.

Refs: nodejs#59872
Refs: nodejs#62084
Signed-off-by: Murat Kirazkaya <groophylifefor@gmail.com>
Assisted-by: Claude Code
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/performance
  • @nodejs/tsc

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. labels Oct 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants