Benchmark: count > 100 with early match (element 101 matches early)
(b *testing.B)
| 175 | |
| 176 | // Benchmark: count > 100 with early match (element 101 matches early) |
| 177 | func BenchmarkCountThresholdEarlyMatch(b *testing.B) { |
| 178 | // Array of 10000 elements, all match predicate, threshold is 101 |
| 179 | // Should exit after ~101 iterations |
| 180 | program, _ := expr.Compile(`count(1..10000, # > 0) > 100`) |
| 181 | var out any |
| 182 | b.ResetTimer() |
| 183 | for n := 0; n < b.N; n++ { |
| 184 | out, _ = vm.Run(program, nil) |
| 185 | } |
| 186 | _ = out |
| 187 | } |
| 188 | |
| 189 | // Benchmark: count >= 50 with early match |
| 190 | func BenchmarkCountThresholdGteEarlyMatch(b *testing.B) { |