Add a new benchmark that tests the ctx acquire and release flow

this will be used later to make differences with version 3 directly visible
pull/3030/head
René 2024-04-03 23:16:51 +02:00
parent f098e2bd9c
commit d0c8f8c82e
1 changed files with 6 additions and 3 deletions

View File

@ -1957,10 +1957,10 @@ func Benchmark_Ctx_AcquireReleaseFlow(b *testing.B) {
fctx := &fasthttp.RequestCtx{}
b.ReportAllocs()
b.ResetTimer()
b.Run("withoutRequestCtx", func(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
c := app.AcquireCtx(fctx)
app.ReleaseCtx(c)
@ -1968,6 +1968,9 @@ func Benchmark_Ctx_AcquireReleaseFlow(b *testing.B) {
})
b.Run("withRequestCtx", func(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
c := app.AcquireCtx(&fasthttp.RequestCtx{})
app.ReleaseCtx(c)