mirror of
https://github.com/gofiber/fiber.git
synced 2025-04-28 22:11:15 +00:00
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
This commit is contained in:
parent
f098e2bd9c
commit
d0c8f8c82e
@ -1957,10 +1957,10 @@ func Benchmark_Ctx_AcquireReleaseFlow(b *testing.B) {
|
|||||||
|
|
||||||
fctx := &fasthttp.RequestCtx{}
|
fctx := &fasthttp.RequestCtx{}
|
||||||
|
|
||||||
b.ReportAllocs()
|
|
||||||
b.ResetTimer()
|
|
||||||
|
|
||||||
b.Run("withoutRequestCtx", func(b *testing.B) {
|
b.Run("withoutRequestCtx", func(b *testing.B) {
|
||||||
|
b.ReportAllocs()
|
||||||
|
b.ResetTimer()
|
||||||
|
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
c := app.AcquireCtx(fctx)
|
c := app.AcquireCtx(fctx)
|
||||||
app.ReleaseCtx(c)
|
app.ReleaseCtx(c)
|
||||||
@ -1968,6 +1968,9 @@ func Benchmark_Ctx_AcquireReleaseFlow(b *testing.B) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
b.Run("withRequestCtx", func(b *testing.B) {
|
b.Run("withRequestCtx", func(b *testing.B) {
|
||||||
|
b.ReportAllocs()
|
||||||
|
b.ResetTimer()
|
||||||
|
|
||||||
for n := 0; n < b.N; n++ {
|
for n := 0; n < b.N; n++ {
|
||||||
c := app.AcquireCtx(&fasthttp.RequestCtx{})
|
c := app.AcquireCtx(&fasthttp.RequestCtx{})
|
||||||
app.ReleaseCtx(c)
|
app.ReleaseCtx(c)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user