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

Function Benchmark_callConstExpr

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

Source from the content-addressed store, hash-verified

414}
415
416func Benchmark_callConstExpr(b *testing.B) {
417 program, err := expr.Compile(`Func()`, expr.Env(CallEnv{}), expr.ConstExpr("Func"))
418 require.NoError(b, err)
419
420 env := CallEnv{}
421
422 var out any
423 b.ResetTimer()
424 for n := 0; n < b.N; n++ {
425 out, err = vm.Run(program, env)
426 }
427 b.StopTimer()
428
429 require.NoError(b, err)
430 require.Equal(b, "func", out)
431}
432
433func Benchmark_largeStructAccess(b *testing.B) {
434 type Env struct {

Callers

nothing calls this directly

Calls 6

CompileFunction · 0.92
EnvStruct · 0.92
ConstExprFunction · 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…