MCPcopy
hub / github.com/gofiber/fiber / Benchmark_Ctx_Render_Engine

Function Benchmark_Ctx_Render_Engine

ctx_test.go:8086–8102  ·  view source on GitHub ↗

go test -v -run=^$ -bench=Benchmark_Ctx_Render_Engine -benchmem -count=4

(b *testing.B)

Source from the content-addressed store, hash-verified

8084
8085// go test -v -run=^$ -bench=Benchmark_Ctx_Render_Engine -benchmem -count=4
8086func Benchmark_Ctx_Render_Engine(b *testing.B) {
8087 engine := &testTemplateEngine{}
8088 err := engine.Load()
8089 require.NoError(b, err)
8090 app := New()
8091 app.config.Views = engine
8092 c := app.AcquireCtx(&fasthttp.RequestCtx{})
8093
8094 b.ReportAllocs()
8095 for b.Loop() {
8096 err = c.Render("index.tmpl", Map{
8097 "Title": "Hello, World!",
8098 })
8099 }
8100 require.NoError(b, err)
8101 require.Equal(b, "<h1>Hello, World!</h1>", string(c.Response().Body()))
8102}
8103
8104// go test -v -run=^$ -bench=Benchmark_Ctx_Get_Location_From_Route -benchmem -count=4
8105func Benchmark_Ctx_Get_Location_From_Route(b *testing.B) {

Callers

nothing calls this directly

Calls 6

LoadMethod · 0.95
AcquireCtxMethod · 0.80
NewFunction · 0.70
RenderMethod · 0.65
BodyMethod · 0.65
ResponseMethod · 0.65

Tested by

no test coverage detected