| 7912 | } |
| 7913 | |
| 7914 | func Benchmark_Ctx_RenderLocals(b *testing.B) { |
| 7915 | engine := &testTemplateEngine{} |
| 7916 | err := engine.Load() |
| 7917 | require.NoError(b, err) |
| 7918 | app := New(Config{ |
| 7919 | PassLocalsToViews: true, |
| 7920 | }) |
| 7921 | app.config.Views = engine |
| 7922 | c := app.AcquireCtx(&fasthttp.RequestCtx{}) |
| 7923 | |
| 7924 | c.Locals("Title", "Hello, World!") |
| 7925 | |
| 7926 | b.ReportAllocs() |
| 7927 | |
| 7928 | for b.Loop() { |
| 7929 | err = c.Render("index.tmpl", Map{}) |
| 7930 | } |
| 7931 | |
| 7932 | require.NoError(b, err) |
| 7933 | require.Equal(b, "<h1>Hello, World!</h1>", string(c.Response().Body())) |
| 7934 | } |
| 7935 | |
| 7936 | func Benchmark_Ctx_RenderViewBind(b *testing.B) { |
| 7937 | engine := &testTemplateEngine{} |