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

Function Benchmark_callFunc

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

Source from the content-addressed store, hash-verified

336}
337
338func Benchmark_callFunc(b *testing.B) {
339 program, err := expr.Compile(`Func()`, expr.Env(CallEnv{}))
340 require.NoError(b, err)
341
342 env := CallEnv{}
343
344 var out any
345 b.ResetTimer()
346 for n := 0; n < b.N; n++ {
347 out, err = vm.Run(program, env)
348 }
349 b.StopTimer()
350
351 require.NoError(b, err)
352 require.Equal(b, "func", out)
353}
354
355func Benchmark_callMethod(b *testing.B) {
356 program, err := expr.Compile(`Foo.Method()`, expr.Env(CallEnv{}))

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…