INNER CODE UNIT · Go
Benchmark_envMap
expr-lang/expr · bench_test.go:293
func Benchmark_envMap(b *testing.B) {
type Price struct {
Value int
}
env := map[string]any{
"price": Price{Value: 1},
}
program, err := expr.Compile(`price.Value > 0`, expr.Env(env))
require.NoError(b, err)
var out any
b.ResetTimer()
for n := 0; n < b.N; n++ {
out, err = vm.Run(program, env)
}
b.StopTimer()