report parses every scene-attached script twice (lint and node-paths)

Offen
#127 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
55/100
Issue-Typ
Refactoring
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
typescript
Bereich
performance, tooling

Rechercherichtung

Read src/scenes/node-paths.ts, src/lint/engine.ts, and src/scenes/report.ts to trace how scripts are parsed in the report flow. Start by checking the existing tests and fixtures, then add a parse counter test for the report path and compare node-path findings before and after the change. Done means each .gd file is parsed once in report and existing node-path findings remain unchanged.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

performance severity: medium

Summary

Node-path validation parses and walks every scene-attached .gd file a second time with tree-sitter. In report, every script is therefore parsed twice: once by lint and once by node-paths. This is now the largest remaining cost in validate-scenes and report.

Where

  • src/scenes/node-paths.ts:103-108 (prefilter, then parseGDScript), src/scenes/node-paths.ts:39 (full walk)
  • src/lint/engine.ts:23, src/scenes/report.ts:46-49

Details

Measured CPU-only:

  • A tree-sitter parse costs 1.1 to 1.3 ms per file, and the index walk 0.55 to 0.9 ms.
  • The prefilter ($ or get_node anywhere in the file) lets almost every real script through.
  • On 3000 attached scripts, validateNodePaths took 7.4 s warm and 9.6 s cold, about 75% of validate-scenes (10 s).
  • In report, about 6.5 s of 20 to 22 s is the second parse and walk.

Suggested fix

  • In report, collect the pathUses data during the lint pass, cached per run by relative path, so each script is parsed once.
  • For standalone validate-scenes, use findAll(root, "get_node") / findAll(root, "call") from the shared index instead of a full walk, and tighten the prefilter to /\$["'A-Za-z_%]|get_node(_or_null)?\s*\(/.

Acceptance criteria

  • report parses each .gd file exactly once (assert with a parse counter in a test).
  • Node-path findings are unchanged on the existing fixtures.

Filed by repo-audit/full-audit at e836036. Severity: medium. Effort: M. audit-key: performance|src/scenes/node-paths.ts|validateNodePaths

Vorherrschende Sprache
TypeScript
Sterne
0
Forks
6
Ø Merge
1 T. 21 Std.
Gemergte PRs (30 T.)
8

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/godot-correctness-mcp

Alle Issues in TMHSDigital/godot-correctness-mcp

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

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