4 ms·
Do you know how it stacks up to httprouter for example? We can run benchmarks all day but it would be cool if you happened to have some real production statisti
by daenney 10y ago
Do you know how it stacks up to httprouter for example? We can run benchmarks all day but it would be cool if you happened to have some real production statistics, by any change?
- buro9 10y agoThey're in the same ballpark, choosing one over the other was preference. The benchmarks skew slightly in favour of httprouter, but only because pressly/chi embraces use of req.Context and this does a few ops. If you add req.Context use to httprouter they're basically the same. If you're doing work with Context, you aren't going to be able to measure a difference that you'll care about. If you're just serving static files, perhaps you'll care.
- mmgutz 10y agohttprouter is unforgiving with routes. IIRC, having both of these routes are not allowed /users/:id /users/create Seems like a common use case.
- peterkieltyka 10y agoInteresting.. and btw, pressly/chi supports those routes easily, among many other combinations. Chi was designed to be very composeable with middlewares, subrouters and handlers. The idea is to consider the request passing through a "flow" of layers, handling and building the response along the way. This makes it easier to reason and organize each piece separately and then connect it all together.