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

Function BenchmarkCall_eval

test/bench/bench_call_test.go:41–63  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

39}
40
41func BenchmarkCall_eval(b *testing.B) {
42 code := `Fn()`
43
44 p, err := expr.Compile(code)
45 require.NoError(b, err)
46 require.Equal(b, p.Bytecode[1], vm.OpCall)
47
48 env := Env{
49 Fn: func() bool {
50 return true
51 },
52 }
53
54 var out any
55 b.ResetTimer()
56 for n := 0; n < b.N; n++ {
57 out, err = expr.Eval(code, env)
58 }
59 b.StopTimer()
60
61 require.NoError(b, err)
62 require.True(b, out.(bool))
63}

Callers

nothing calls this directly

Calls 5

CompileFunction · 0.92
NoErrorFunction · 0.92
EqualFunction · 0.92
EvalFunction · 0.92
TrueFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…