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

Offen Anfängerfreundlich
#261 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
82/100
Issue-Typ
Refactoring
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
javascript, node.js
Bereich
performance, tooling

Rechercherichtung

Beginne mit site/lint.mjs:69-80, insbesondere mit dem Aufruf execFileSync in Zeile 73, und lies nach, wie Skriptdateien gesammelt und Fehler gemeldet werden. Führe npm run -s lint aus, um die aktuelle Laufzeit zu messen, und verwende anschließend npm test, um das Verhalten zu prüfen. Fertig ist es, wenn Prüfungen parallel mit einem auf os.availableParallelism() begrenzten Pool laufen, Fehler in Dateireihenfolge bleiben und Lint auf einem Mehrkernsystem deutlich schneller ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
JavaScript
Sterne
58
Forks
15
Ø Merge
1 T. 15 Std.
Gemergte PRs (30 T.)
12

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TMHSDigital/Free-Game-Dev-Assets

Alle Issues in TMHSDigital/Free-Game-Dev-Assets

Ähnliche Issues

Weitere Issues zu JavaScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.