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