Improved performance

This commit is contained in:
2024-03-14 00:06:20 +01:00
parent 80dc3f87eb
commit 594cad69db
3 changed files with 10 additions and 16 deletions

View File

@ -40,17 +40,6 @@ type ctx struct {
handlerCount int
}
// newContext returns a new context from the pool.
func newContext(req *http.Request, res http.ResponseWriter, server *Server) *ctx {
ctx := contextPool.Get().(*ctx)
ctx.request = req
ctx.response = res
ctx.server = server
ctx.paramCount = 0
ctx.handlerCount = 0
return ctx
}
// Bytes responds with a raw byte slice.
func (ctx *ctx) Bytes(body []byte) error {
_, err := ctx.response.Write(body)