Benchmark: count >= 50 with early match
(b *testing.B)
| 188 | |
| 189 | // Benchmark: count >= 50 with early match |
| 190 | func BenchmarkCountThresholdGteEarlyMatch(b *testing.B) { |
| 191 | // All elements match, threshold is 50 |
| 192 | // Should exit after ~50 iterations |
| 193 | program, _ := expr.Compile(`count(1..10000, # > 0) >= 50`) |
| 194 | var out any |
| 195 | b.ResetTimer() |
| 196 | for n := 0; n < b.N; n++ { |
| 197 | out, _ = vm.Run(program, nil) |
| 198 | } |
| 199 | _ = out |
| 200 | } |
| 201 | |
| 202 | // Benchmark: count > 100 with no early exit (not enough matches) |
| 203 | func BenchmarkCountThresholdNoEarlyExit(b *testing.B) { |