delta-misuse walks each function twice, about 20% of lint time

Offen
#128 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
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
75/100
Issue-Typ
Refactoring
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
typescript
Bereich
performance, tooling

Rechercherichtung

Read src/gdscript/ast.ts around walkSubtree and functionCalls, then inspect src/lint/rules/delta-misuse.ts:72-75 to trace the repeated traversal. Run npm run build && npm test and compare per-rule timing on the fixture set. Done means existing delta-misuse findings are unchanged and its timing is no higher than any other rule.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

good first issue performance severity: medium

Summary

delta-misuse walks each function subtree twice, re-marshalling every node through web-tree-sitter namedChildren. It accounts for about 20% of total lint time even after the shared traversal (#85).

Where

  • src/lint/rules/delta-misuse.ts:72-75
  • src/gdscript/ast.ts:13-21 (walkSubtree), src/gdscript/ast.ts:128-135 (functionCalls)

Details

Per-rule timing over 500 files, with the shared index already built:

Rule Time
delta-misuse 354 ms (about 0.7 ms per file)
connect-without-disconnect 94 ms
stringly-nodepath 83 ms
every other rule under 20 ms

Total lint cost is about 3.1 to 4.2 ms per file, so on 3000 files delta-misuse costs about 2.1 s of a 9 to 12 s run. In the CPU profile, marshalNode, walkSubtree and get type are the top JS self-time entries.

Suggested fix

For non-root nodes, have walk(node) return the contiguous pre-order slice of the per-tree index (from the node's position until startIndex >= node.endIndex), and compute callsMove in that same single pass. This also speeds up the other subtree walkers.

Acceptance criteria

  • delta-misuse findings are unchanged on the existing tests.
  • delta-misuse costs no more than any other rule in a per-rule timing over a fixture set.

Getting started

  • Relevant files: src/gdscript/ast.ts, src/lint/rules/delta-misuse.ts
  • How to run tests: npm run build && npm test

Filed by repo-audit/full-audit at e836036. Severity: medium. Effort: S. audit-key: performance|src/lint/rules/delta-misuse.ts|check

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.