MCPcopy Index your code
hub / github.com/expr-lang/expr / Benchmark_expr_eval

Function Benchmark_expr_eval

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

Source from the content-addressed store, hash-verified

32}
33
34func Benchmark_expr_eval(b *testing.B) {
35 params := make(map[string]any)
36 params["Origin"] = "MOW"
37 params["Country"] = "RU"
38 params["Adults"] = 1
39 params["Value"] = 100
40
41 var out any
42 var err error
43
44 b.ResetTimer()
45 for n := 0; n < b.N; n++ {
46 out, err = expr.Eval(`(Origin == "MOW" || Country == "RU") && (Value >= 100 || Adults == 1)`, params)
47 }
48 b.StopTimer()
49
50 require.NoError(b, err)
51 require.True(b, out.(bool))
52}
53
54func Benchmark_expr_reuseVm(b *testing.B) {
55 params := make(map[string]any)

Callers

nothing calls this directly

Calls 3

EvalFunction · 0.92
NoErrorFunction · 0.92
TrueFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…