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

Abierto
#197 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
22/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
go

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Go
Estrellas
0
Forks
0
Merge medio
7 h 42 min
PR fusionados (30 d)
111

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de seanb4t/codegraph-go

Todos los issues de seanb4t/codegraph-go

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.