From 014650da071326a9ee2edf3c6a1b5decabd1b5cf Mon Sep 17 00:00:00 2001 From: Carl Jackson Date: Sun, 4 May 2014 10:02:04 -0700 Subject: [PATCH] Only make a best-effort to release mStacks It doesn't *actually* matter, and getting rid of the defer is worth ~80ns of perf. --- web/mux.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/web/mux.go b/web/mux.go index fcc67e8..e40eaf1 100644 --- a/web/mux.go +++ b/web/mux.go @@ -74,16 +74,14 @@ func New() *Mux { func (m *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request) { stack := m.mStack.alloc() - defer m.mStack.release(stack) - stack.ServeHTTP(w, r) + m.mStack.release(stack) } // ServeHTTPC creates a context dependent request with the given Mux. Satisfies // the web.Handler interface. func (m *Mux) ServeHTTPC(c C, w http.ResponseWriter, r *http.Request) { stack := m.mStack.alloc() - defer m.mStack.release(stack) - stack.ServeHTTPC(c, w, r) + m.mStack.release(stack) }