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

Function Benchmark_len

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

Source from the content-addressed store, hash-verified

75}
76
77func Benchmark_len(b *testing.B) {
78 env := map[string]any{
79 "arr": make([]int, 100),
80 }
81
82 program, err := expr.Compile(`len(arr)`, expr.Env(env))
83 require.NoError(b, err)
84
85 var out any
86 b.ResetTimer()
87 for n := 0; n < b.N; n++ {
88 out, err = vm.Run(program, env)
89 }
90 b.StopTimer()
91
92 require.NoError(b, err)
93 require.Equal(b, 100, out)
94}
95
96func Benchmark_filter(b *testing.B) {
97 type Env struct {

Callers

nothing calls this directly

Calls 5

CompileFunction · 0.92
EnvStruct · 0.92
NoErrorFunction · 0.92
RunFunction · 0.92
EqualFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…