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

Function BenchmarkReduceRangeSum_Optimized

optimizer/sum_range_test.go:263–275  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

261}
262
263func BenchmarkReduceRangeSum_Optimized(b *testing.B) {
264 program, err := expr.Compile(`reduce(1..100, # + #acc)`)
265 require.NoError(b, err)
266
267 var out any
268 b.ResetTimer()
269 for n := 0; n < b.N; n++ {
270 out, _ = expr.Run(program, nil)
271 }
272 b.StopTimer()
273
274 require.Equal(b, 5050, out)
275}
276
277func BenchmarkSumRange_Unoptimized(b *testing.B) {
278 program, err := expr.Compile(`sum(1..100)`, expr.Optimize(false))

Callers

nothing calls this directly

Calls 4

CompileFunction · 0.92
NoErrorFunction · 0.92
RunFunction · 0.92
EqualFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…