perf(indexer): an incremental sync reads the whole store

オープン
#197 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
22/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go

調査の方向性

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 の本文から書いたものです。

説明

area:indexer enhancement priority:low

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 (GetFile per 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 calls edge 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分
マージ済み PR(30日)
111

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

seanb4t/codegraph-go のほかの issue

seanb4t/codegraph-go の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。