lint spawns node --check for 49 files one after another (about 10 s on Windows)

オープン 初心者向け
#261 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, node.js

調査の方向性

site/lint.mjs:69-80から始め、特に73行目のexecFileSync呼び出しを確認し、スクリプトファイルの収集方法とエラーの報告方法を読んでください。npm run -s lintを実行して現在の所要時間を測り、その後npm testで動作を確認してください。完了の条件は、チェックがos.availableParallelism()を上限とするプールで並行実行され、エラーがファイル順に維持され、マルチコアマシンでlintが大幅に高速化することです。

索引モデルが issue の本文から書いたものです。

説明

good first issue performance priority: low

Summary

lint.mjs runs a blocking node --check subprocess per script file in sequence, which makes it the slowest step of npm run check.

Where

  • site/lint.mjs:69-80 (the execFileSync(process.execPath, ["--check", file]) call at :73)

Details

Measured on a Windows dev machine: npm run -s lint 10.8 s vs test 5.1 s, validate 4.8 s, check-added 4.5 s. A single node --check is about 400 ms there; on Linux CI it is about 40-60 ms per file. Cost grows linearly with the number of scripts.

Impact

About a third of every local npm run check, and a smaller share of each CI run.

Steps to reproduce

  1. Time npm run -s lint.
  2. Time node --check site/build.mjs in the same shell and multiply by 49.

Suggested fix

Run the checks in parallel with promisified execFile and a pool capped at os.availableParallelism(), then report errors in file order. Behaviour stays identical.

Acceptance criteria

  • Same errors in the same order
  • Lint wall time drops substantially on a multi-core machine

Getting started

  • Relevant files: site/lint.mjs
  • Run the tests: npm test; the full local gate is npm run check (Node 22+, no install step)
  • Related docs: CONTRIBUTING.md, site/README.md

Filed by repo-audit/full-audit at 4adb944. Severity: low. Effort: S. audit-key: performance|site/lint.mjs|scriptFiles-check

主要言語
JavaScript
スター
58
フォーク
15
平均マージ
1日 15時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TMHSDigital/Free-Game-Dev-Assets のほかの issue

TMHSDigital/Free-Game-Dev-Assets の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。