MCPcopy
hub / github.com/expr-lang/expr / Benchmark_envMap

Function Benchmark_envMap

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

Source from the content-addressed store, hash-verified

291}
292
293func Benchmark_envMap(b *testing.B) {
294 type Price struct {
295 Value int
296 }
297 env := map[string]any{
298 "price": Price{Value: 1},
299 }
300
301 program, err := expr.Compile(`price.Value > 0`, expr.Env(env))
302 require.NoError(b, err)
303
304 var out any
305 b.ResetTimer()
306 for n := 0; n < b.N; n++ {
307 out, err = vm.Run(program, env)
308 }
309 b.StopTimer()
310
311 require.NoError(b, err)
312 require.True(b, out.(bool))
313}
314
315type CallEnv struct {
316 A int

Callers

nothing calls this directly

Calls 5

CompileFunction · 0.92
EnvStruct · 0.92
NoErrorFunction · 0.92
RunFunction · 0.92
TrueFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…