-
-
Notifications
You must be signed in to change notification settings - Fork 11
Performance
Lisa edited this page Dec 17, 2025
·
13 revisions
Performance characteristics and benchmarks for CKB navigation tools.
CKB tools are classified by performance budget:
| Budget | P95 Target | Tools |
|---|---|---|
| Cheap | < 300ms |
searchSymbols, explainFile, listEntrypoints, explainPath, getSymbol, explainSymbol
|
| Heavy | < 2000ms |
traceUsage, getArchitecture, getHotspots, summarizeDiff, recentlyRelevant, listKeyConcepts, analyzeImpact, getCallGraph, findReferences, justifySymbol
|
Environment: Apple M4 Pro, Go 1.23, macOS
In-memory processing functions complete in nanoseconds to microseconds:
| Function | Time | Description |
|---|---|---|
classifyFileRiskLevel |
1.0 ns | Risk classification for diff files |
classifyHotspotRisk |
0.77 ns | Churn-based risk assessment |
computeDiffConfidence |
2.2 ns | Confidence calculation |
computePathConfidence |
1.0 ns | Path confidence from basis |
detectLanguage |
7.3 ns | Language from file extension |
suggestTestPath |
19 ns | Test file path generation |
titleCase |
29 ns | Simple title casing |
classifyRecency |
43 ns | Timestamp recency classification |
computeRecencyScore |
44 ns | Recency scoring |
classifyFileRole |
78 ns | File role from path patterns |
splitCamelCase |
116 ns | CamelCase word splitting |
classifyPathRole |
297 ns | Full path role classification |
categorizeConceptV52 |
561 ns | Concept categorization |
buildDiffSummary |
674 ns | Diff summary text generation |
extractConcept |
903 ns | Concept extraction from names |
Simulated tool processing with multiple items:
| Pipeline | Items | Time | Budget | Headroom |
|---|---|---|---|---|
| PathClassification | 10 paths | 3.0 us | 300ms | 99.999% |
| DiffProcessing | 50 files | 8.9 us | 2000ms | 99.999% |
| HotspotProcessing | 50 items | 10.1 us | 2000ms | 99.999% |
| ConceptExtraction | 10 names | 14.9 us | 2000ms | 99.999% |
In-memory processing is negligible. Real-world latency is dominated by I/O:
- SCIP index lookups - Symbol search, references, call graph traversal
- Git history queries - Commit history, diff stats, churn metrics
- File system operations - Directory traversal, file reads
This is by design - CKB's value is in orchestrating these I/O operations efficiently and compressing results for LLM consumption.
# Run all benchmarks
go test ./internal/query/... -bench=. -benchmem -run=^$
# Run specific benchmark
go test ./internal/query/... -bench=BenchmarkClassifyPathRole -benchmem -run=^$
# Run with CPU profiling
go test ./internal/query/... -bench=BenchmarkDiffProcessingPipeline -cpuprofile=cpu.prof -run=^$- Keep SCIP index fresh - Stale indexes cause fallback to slower backends
-
Use scoped queries - Adding
scopeparameter reduces search space - Set reasonable limits - Don't request 1000 results if you need 20
- Profile before optimizing - Most time is in I/O, not CPU
- Cache aggressively - CKB's three-tier cache handles this
- Batch I/O operations - Fewer round trips beats faster processing
- MCP Integration - Tool documentation and usage
- Architecture - How CKB processes queries
- Configuration - Cache and backend settings