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

Function Benchmark_callMethod

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

Source from the content-addressed store, hash-verified

353}
354
355func Benchmark_callMethod(b *testing.B) {
356 program, err := expr.Compile(`Foo.Method()`, expr.Env(CallEnv{}))
357 require.NoError(b, err)
358
359 env := CallEnv{}
360
361 var out any
362 b.ResetTimer()
363 for n := 0; n < b.N; n++ {
364 out, err = vm.Run(program, env)
365 }
366 b.StopTimer()
367
368 require.NoError(b, err)
369 require.Equal(b, "method", out)
370}
371
372func Benchmark_callField(b *testing.B) {
373 program, err := expr.Compile(`Fn()`, 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…