MCPcopy Create free account
hub / github.com/expr-lang/expr / BenchmarkCountThresholdEarlyMatch

Function BenchmarkCountThresholdEarlyMatch

optimizer/count_threshold_test.go:177–187  ·  view source on GitHub ↗

Benchmark: count > 100 with early match (element 101 matches early)

(b *testing.B)

Source from the content-addressed store, hash-verified

175
176// Benchmark: count > 100 with early match (element 101 matches early)
177func 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
190func BenchmarkCountThresholdGteEarlyMatch(b *testing.B) {

Callers

nothing calls this directly

Calls 2

CompileFunction · 0.92
RunFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…