(b *testing.B)
| 163 | } |
| 164 | |
| 165 | func BenchmarkSearch_ConcurrentReads(b *testing.B) { |
| 166 | dir := b.TempDir() |
| 167 | generateFileTree(b, dir, 10_000, 42) |
| 168 | |
| 169 | logger := slogtest.Make(b, &slogtest.Options{IgnoreErrors: true}).Leveled(slog.LevelError) |
| 170 | ctx := context.Background() |
| 171 | eng := filefinder.NewEngine(logger) |
| 172 | require.NoError(b, eng.AddRoot(ctx, dir)) |
| 173 | b.Cleanup(func() { _ = eng.Close() }) |
| 174 | |
| 175 | opts := filefinder.DefaultSearchOptions() |
| 176 | goroutines := []int{1, 4, 16, 64} |
| 177 | |
| 178 | for _, g := range goroutines { |
| 179 | b.Run(fmt.Sprintf("goroutines_%d", g), func(b *testing.B) { |
| 180 | b.SetParallelism(g) |
| 181 | b.ResetTimer() |
| 182 | b.RunParallel(func(pb *testing.PB) { |
| 183 | for pb.Next() { |
| 184 | results, err := eng.Search(ctx, "handler", opts) |
| 185 | if err != nil { |
| 186 | b.Fatal(err) |
| 187 | } |
| 188 | _ = results |
| 189 | } |
| 190 | }) |
| 191 | }) |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | func BenchmarkDeltaUpdate(b *testing.B) { |
| 196 | dir := b.TempDir() |
nothing calls this directly
no test coverage detected