uid index rebuilt per check and scripts re-read outside the per-run cache
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- godot, typescript
- Lĩnh vực
- performance, tooling
Hướng nghiên cứu
Start with src/project/files.ts:14-59 to understand the per-run read cache, then trace the listed call sites in src/scenes/validate.ts, uids.ts and scene-graph.ts. Add a projectReport test that counts fs.readFileSync calls, as suggested, and use it to check the acceptance criteria: each file is read at most once per report run and no module-global file cache remains.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The per-run "one walk, one read" index (#87) is bypassed in three places:
- The uid index is rebuilt by each check.
- Scripts are re-read in connection and registry checks.
scene-graph.tskeeps its own process-global script cache, which is never evicted.
On a modern Godot 4.4+ project, report performs about 17.9k file reads for 6.5k files.
Where
src/scenes/validate.ts:73-76,:184,:238,:315(lazyUidIndex(root)is created separately invalidateScenes,validateProjectConfigandvalidateRegistries)src/scenes/uids.ts:16-31(buildUidIndexwalks the whole tree and reads every.tscn/.tresin full, only to use the first 512 characters)src/scenes/scene-graph.ts:148-163(scriptInfo: module-globalscriptCachekeyed by absolute path, validated by mtime and size, never evicted; onestatSyncper[connection])src/scenes/validate.ts:233,:290-297,:333,:361(project.godot,readClassNameand registry.tresfiles are read withreadFileSyncinstead ofreadSource)- Compare
src/project/files.ts:14-59
Details
Measured on a synthetic project with 3000 .gd (each with a .uid sidecar), 300 .tscn and 200 registry .tres files, with run/main_scene="uid://...":
| Read count | Files | Reads |
|---|---|---|
.uid |
3000 | 9000 |
.tscn |
300 | 1200 |
.tres |
200 | 800 |
.gd (validate-scenes) |
3000 | 5700, plus 2701 statSync calls |
readClassName reads the same script once per registry entry. Building the uid index alone costs about 1.4 s. Rebuilding it pushes report from about 22 s to about 25 s (roughly 12%).
The global scriptCache behaves differently from everything else in a long-lived MCP server. It holds entries for every project seen, and it misses edits that keep the same mtime and size.
Impact
report and project_report time grows with asset and connection counts, and is worst on Windows and network filesystems. New checks have to choose between three caching models.
Suggested fix
- Add a test that counts reads per
projectReport(spy onfs.readFileSync) and records today's number. - Memoise the uid index in the per-run index (keyed by cfg and root, like
readSource), and read only the head of.tscn/.tresfiles, or reusereadSourcecontent. - Route
scriptInfo,readClassName,project.godotand the registry.tresreads throughreadSource. Delete the module-globalscriptCache, or move it into the per-run index. - Lower the read count asserted in the step-1 test.
Acceptance criteria
- Each file is read at most once per
reportrun. - No module-global file cache remains.
Filed by repo-audit/full-audit at e836036. Severity: medium. Effort: M. audit-key: performance|src/scenes/validate.ts|lazyUidIndex
- Ngôn ngữ chính
- TypeScript
- Star
- 0
- Fork
- 6
- Merge trung bình
- 1 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TMHSDigital/godot-correctness-mcp
-
enhancement good first issue severity: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
TMHSDigital/godot-correctness-mcp#123 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
dependencies good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
TMHSDigital/godot-correctness-mcp#116 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
TMHSDigital/godot-correctness-mcp#107 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
TMHSDigital/godot-correctness-mcp#106 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug good first issue severity: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
TMHSDigital/godot-correctness-mcp#105 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của TMHSDigital/godot-correctness-mcp
Issue tương tự
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
openclaw/openclaw#203385 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nwverse/persona#12800 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
microsoft/playwright#44289 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày