diff --git a/internal/storage/sqlite/sqlite_bench_test.go b/internal/storage/sqlite/sqlite_bench_test.go index b1f1fc57..752330e0 100644 --- a/internal/storage/sqlite/sqlite_bench_test.go +++ b/internal/storage/sqlite/sqlite_bench_test.go @@ -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