Skip to content

Commit 4a536fd

Browse files
committed
Add groupBy bench
1 parent 12f7b7c commit 4a536fd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

bench_test.go

+14
Original file line numberDiff line numberDiff line change
@@ -498,3 +498,17 @@ func Benchmark_sortBy(b *testing.B) {
498498
require.Equal(b, 1, out.([]any)[0].(Foo).Value)
499499
require.Equal(b, 100, out.([]any)[99].(Foo).Value)
500500
}
501+
502+
func Benchmark_groupBy(b *testing.B) {
503+
program, err := expr.Compile(`groupBy(1..100, # % 7)[6]`)
504+
require.NoError(b, err)
505+
506+
var out interface{}
507+
b.ResetTimer()
508+
for n := 0; n < b.N; n++ {
509+
out, _ = vm.Run(program, nil)
510+
}
511+
b.StopTimer()
512+
513+
require.Equal(b, 6, out.([]any)[0])
514+
}

0 commit comments

Comments
 (0)