Improved performance
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user