Improved performance
This commit is contained in:
parent
322f6acbca
commit
5653479928
3 changed files with 10 additions and 16 deletions
11
Context.go
11
Context.go
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue