which is a pretty thorough benchmark for Go multiplexers. The author's own framework is always fastest and takes the least amount of memory (there's nothing suspicious about it, it really is the fastest).
The test does a good job of showing just how horribly slow some of these, like Gorilla or Martini, really are. Anyways, Bone seems better than the horrible ones, but it's far from the fastest. A snapshot:
It also crashed on one of the test (first time I've seen that, so maybe I set it up wrong).
The actual way to match routes is important, but something else that a lot of people miss is how to load the Params. If you want to keep the *http.Request interface, there's little choice but to append values to the req.URL.RawQuery so that they can be pulled out via req.URL.Query("...") (which, by the way, everytime time you call Query(), RawQuery gets re-parsed). This is the approach Bone appears to take. It's unfortunate because it results in extra string concatenation. If you want speed, you need to break Go's interface, expose your own req object, and use a pool or something for the params.
The "horribly slow" Gorilla still completes most of my requests in under a millisecond, whereas something actually slow, such as PHP, takes around 200ms, even for the simplest requests.
Gorilla gives me a lot of comfort, but httprouter might be interesting once I remove other bottlenecks in my app. For most developers, swapping the two is a very premature optimization.
https://github.com/julienschmidt/go-http-routing-benchmark
which is a pretty thorough benchmark for Go multiplexers. The author's own framework is always fastest and takes the least amount of memory (there's nothing suspicious about it, it really is the fastest).
The test does a good job of showing just how horribly slow some of these, like Gorilla or Martini, really are. Anyways, Bone seems better than the horrible ones, but it's far from the fastest. A snapshot:
It also crashed on one of the test (first time I've seen that, so maybe I set it up wrong).The actual way to match routes is important, but something else that a lot of people miss is how to load the Params. If you want to keep the *http.Request interface, there's little choice but to append values to the req.URL.RawQuery so that they can be pulled out via req.URL.Query("...") (which, by the way, everytime time you call Query(), RawQuery gets re-parsed). This is the approach Bone appears to take. It's unfortunate because it results in extra string concatenation. If you want speed, you need to break Go's interface, expose your own req object, and use a pool or something for the params.