xonecas.io
62159
Sy

symb / files

symb / performance_issues.md

2.2 KB
1# Performance issues
2
3Ordered by severity (most impactful first), based on investigation evidence.
4
51. **Per-edit SQLite writes for undo tracking (blocking, frequent).**
6   - `delta.Tracker.RecordModify`/`RecordCreate` hit SQLite under a mutex per edit (SELECT + INSERT), likely dominating turn time during edits.
7   - Evidence: `internal/delta/delta.go:33-39:a0`, `internal/delta/delta.go:48-90:a0`.
8
92. **Snapshotting on the LLM turn path (filesystem-heavy).**
10   - Pre/post snapshots run inline each turn; full directory snapshotting adds latency.
11   - Evidence: `internal/tui/messages.go:284:5a`, `internal/tui/messages.go:303:ed`, `internal/tui/messages.go:340:54-356:0f`.
12
133. **Sequential tool execution + high tool round cap.**
14   - Tool calls are executed sequentially; slow tools block the turn.
15   - Default `MaxToolRounds = 30` can cause multiple full LLM calls per turn.
16   - Evidence: `internal/llm/loop.go:303-355:05`, `internal/llm/loop.go:122-166:f6`.
17
184. **Session save/load serialization with per-message inserts.**
19   - Global mutex held across transaction; per-message `Exec` in loop.
20   - Busy retry sleeps can add delay.
21   - Evidence: `internal/store/session.go:71-85:fc`, `internal/store/session.go:96-155:fc`, `internal/store/session.go:158-199:d3`.
22
235. **O(n²) string concatenation during stream accumulation.**
24   - Content and tool args concatenated per delta, causing quadratic behavior for long outputs.
25   - Evidence: `internal/llm/loop.go:243-246:ea`, `internal/llm/loop.go:258-295:6c`.
26
276. **Per-delta UI dispatch overhead.**
28   - One channel send per delta; can cause backpressure under high token rates.
29   - Evidence: `internal/tui/messages.go:359:6c-365:a3`.
30
317. **LSP initialization/diagnostic waits block.**
32   - LSP init can block up to 15s per server; notify waits for diagnostics (debounce + timeout).
33   - Evidence: `internal/lsp/manager.go:182-195`, `internal/lsp/manager.go:221-226`, `internal/lsp/client.go:144-175`.
34
358. **File search overhead.**
36   - WalkDir with per-entry stat, regex gitignore per entry, and full file scans even after `MaxResults`.
37   - Evidence: `internal/filesearch/filesearch.go:69-126`, `internal/filesearch/filesearch.go:158-179`, `internal/filesearch/gitignore.go:73-94`.