bench(sqlite): add isolated cache rebuild benchmarks (bd-zw72)

Add BenchmarkRebuildBlockedCache_Large and _XLarge to measure cache
rebuild performance in isolation.

Results show cache rebuild takes ~773ms at 10K issues and ~1.3s at 20K,
significantly slower than the ~50ms originally estimated in the issue.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
beads/crew/wolf
2026-01-02 17:30:58 -08:00
committed by Steve Yegge
parent 32a4a9e060
commit d416d672db

View File

@@ -236,6 +236,39 @@ func BenchmarkSyncMerge(b *testing.B) {
}
}
// BenchmarkRebuildBlockedCache_Large benchmarks cache rebuild in isolation on 10K database
// This measures the core operation that bd-zw72 is investigating for incremental optimization
func BenchmarkRebuildBlockedCache_Large(b *testing.B) {
store, cleanup := setupLargeBenchDB(b)
defer cleanup()
ctx := context.Background()
b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
if err := store.rebuildBlockedCache(ctx, nil); err != nil {
b.Fatalf("rebuildBlockedCache failed: %v", err)
}
}
}
// BenchmarkRebuildBlockedCache_XLarge benchmarks cache rebuild in isolation on 20K database
func BenchmarkRebuildBlockedCache_XLarge(b *testing.B) {
store, cleanup := setupXLargeBenchDB(b)
defer cleanup()
ctx := context.Background()
b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
if err := store.rebuildBlockedCache(ctx, nil); err != nil {
b.Fatalf("rebuildBlockedCache failed: %v", err)
}
}
}
// Helper function
func intPtr(i int) *int {
return &i