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

Function Benchmark_callField

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

Source from the content-addressed store, hash-verified

370}
371
372func Benchmark_callField(b *testing.B) {
373 program, err := expr.Compile(`Fn()`, expr.Env(CallEnv{}))
374 require.NoError(b, err)
375
376 env := CallEnv{
377 Fn: func() bool {
378 return true
379 },
380 }
381
382 var out any
383 b.ResetTimer()
384 for n := 0; n < b.N; n++ {
385 out, err = vm.Run(program, env)
386 }
387 b.StopTimer()
388
389 require.NoError(b, err)
390 require.True(b, out.(bool))
391}
392
393func Benchmark_callFast(b *testing.B) {
394 program, err := expr.Compile(`FnFast()`, expr.Env(CallEnv{}))

Callers

nothing calls this directly

Calls 5

CompileFunction · 0.92
EnvStruct · 0.92
NoErrorFunction · 0.92
RunFunction · 0.92
TrueFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…