Improved performance
This commit is contained in:
parent
00c85d5e15
commit
b30dad77dc
4 changed files with 27 additions and 22 deletions
|
@ -57,7 +57,10 @@ func New() Server {
|
|||
}
|
||||
|
||||
s.pool.New = func() any {
|
||||
return &ctx{server: s}
|
||||
return &ctx{
|
||||
server: s,
|
||||
params: make([]param, 0, 8),
|
||||
}
|
||||
}
|
||||
|
||||
return s
|
||||
|
@ -94,7 +97,7 @@ func (s *server) ServeHTTP(response http.ResponseWriter, request *http.Request)
|
|||
s.errorHandler(ctx, err)
|
||||
}
|
||||
|
||||
ctx.paramCount = 0
|
||||
ctx.params = ctx.params[:0]
|
||||
ctx.handlerCount = 0
|
||||
s.pool.Put(ctx)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue