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

Aperta
#128 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
75/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TypeScript
Stelle
0
Fork
6
Merge medio
1g 21h
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TMHSDigital/godot-correctness-mcp

Tutte le issue di TMHSDigital/godot-correctness-mcp

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.