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

Function Benchmark_groupBy

bench_test.go:547–559  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

545}
546
547func Benchmark_groupBy(b *testing.B) {
548 program, err := expr.Compile(`groupBy(1..100, # % 7)[6]`)
549 require.NoError(b, err)
550
551 var out any
552 b.ResetTimer()
553 for n := 0; n < b.N; n++ {
554 out, _ = vm.Run(program, nil)
555 }
556 b.StopTimer()
557
558 require.Equal(b, 6, out.([]any)[0])
559}
560
561func Benchmark_reduce(b *testing.B) {
562 program, err := expr.Compile(`reduce(1..100, # + #acc)`)

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…