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

未关闭
#127 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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

主要语言
TypeScript
星标
0
派生
6
平均合并
1 天 21 小时
30 天内合并 PR
8

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TMHSDigital/godot-correctness-mcp 的其他 Issue

查看 TMHSDigital/godot-correctness-mcp 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。