Skip to content

Commit

Permalink
Create RequestCtx outside loop
Browse files Browse the repository at this point in the history
  • Loading branch information
gaby committed Dec 21, 2024
1 parent b4ab2c1 commit 327d195
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -903,11 +903,11 @@ func Benchmark_Router_Next_Default_Parallel(b *testing.B) {
b.ResetTimer()

b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
fctx := &fasthttp.RequestCtx{}
fctx.Request.Header.SetMethod(MethodGet)
fctx.Request.SetRequestURI("/")
fctx := &fasthttp.RequestCtx{}
fctx.Request.Header.SetMethod(MethodGet)
fctx.Request.SetRequestURI("/")

for pb.Next() {
h(fctx)
}
})
Expand Down

0 comments on commit 327d195

Please sign in to comment.