Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not recreate mux router for each incoming request
(*App).context, called in the HTTP handler on each request, creates a URLBuilder, which involves calling Router(). This shows up in profiles a hot spot because it involves compiling the regexps which define all the routes. For efficiency, cache the router and return the same object each time. It appears to be safe to reuse the router because GetRoute is the only method ever called on the returned router object. Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
- Loading branch information