perf(indexer): an incremental sync reads the whole store
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 22/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- go
- 领域
- performance, tooling
调研方向
Start in internal/indexer/storeview.go, where loadStoreView reads every node and edge, and follow buildReverseAdjacency and the implements/override synthesis from there. First add the sync benchmark under tools/bench: a large generated corpus with one changed file, reporting time and peak RSS. Done means the benchmark runs and the reads and synthesis in the sync path are cut down, while requireSyncEqualsRun and the 30-commit replay still pass.
由索引模型根据 Issue 内容生成。
描述
Every codegraph sync that reparses or deletes a file reads the whole store. Its cost therefore grows with the size of the repository, not with the size of the change. The file watcher and the daemon run it after each save, and serve runs it before every MCP handshake.
What a sync reads today (after #192, #195 and #196)
- Every File record: the stat pre-filter (
GetFileper discovered file), the deletion check (IterateFiles) and, when the sync adds a symbol, the waiting-file check (filesWaitingOn). - Every node and every edge, in
loadStoreView(internal/indexer/storeview.go). It builds the store-seeded symbol index and the lookups that resolution and edge synthesis read. - Every
callsedge again when the sync removes a node (buildReverseAdjacency). - Implements and override synthesis over the whole graph, held in memory.
A sync with no changes returns before any of this.
Why it reads everything. Resolving a batch the way a fresh index does needs any symbol a batch file can reference, and any type or interface its edges can match. #196 chose correctness over cost. Nothing measures sync cost today: the perf regression gate (tools/bench) measures a full index, query latency, peak RSS and cold start.
What to do
- Add a sync benchmark to
tools/bench: a large generated corpus, one file changed, time and peak RSS of the sync. - Read on demand, not up front. Look up a node's kind or edges (
GetNode,IterateEdges(source)) as resolution needs them, and cache them for the sync. Looking up a referenced name's symbols the same way needs a store index keyed by module and name, which would be new. - Limit implements and override synthesis to the types and interfaces whose method sets the batch changes, with the stored synthesized edges of those types as the set to compare against.
- Keep the equality tests (
requireSyncEqualsRun, the 30-commit replay in #196) as the check that a cheaper sync still matches a fresh index.
🤖 Generated with Claude Code
- 主要语言
- Go
- 星标
- 0
- 派生
- 0
- 平均合并
- 7 小时 42 分钟
- 30 天内合并 PR
- 111
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
seanb4t/codegraph-go 的其他 Issue
-
chore needs-triage
难度 1/5 1 小时以内 新手友好度 88/100
seanb4t/codegraph-go#380 ·
维护者通常 1 天内回复
-
chore needs-triage
难度 2/5 1-3 小时 新手友好度 82/100
seanb4t/codegraph-go#379 ·
维护者通常 1 天内回复
-
area:query chore needs-triage spec-needed
难度 2/5 1-3 小时 新手友好度 74/100
seanb4t/codegraph-go#377 ·
维护者通常 1 天内回复
-
chore needs-triage
难度 1/5 1-3 小时 新手友好度 84/100
seanb4t/codegraph-go#362 ·
维护者通常 1 天内回复
-
area:query bug needs-triage
难度 2/5 1-3 小时 新手友好度 80/100
seanb4t/codegraph-go#355 ·
维护者通常 1 天内回复
查看 seanb4t/codegraph-go 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
OneBusAway/maglev#2145 ·
维护者通常 2 天内回复
-
priority/medium status/ready type/chore
难度 2/5 1-3 小时 新手友好度 84/100
discobox-ai/discobox#1357 ·
维护者通常 1 天内回复
-
TestPseudoLocaleRemote fails now and then: it types the code before the laptop asks for it可能已有人在做 @fzn0x 今天认领。 未关闭bug priority: low
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
edit_file diff rendering panics on invalid UTF-8 text可能已有人在做 @TDnorthgarden 今天认领。 未关闭area/tui
难度 2/5 1-3 小时 新手友好度 85/100
docker/docker-agent#4955 ·
维护者通常 1 天内回复
-
enhancement ui/ux
难度 2/5 1-3 小时 新手友好度 68/100
jbigler/railswitch#243 ·
维护者通常 1 天内回复