4 ms·
Martini is slow, try again with Negroni which is the new lib by the author of Martini.
by patrickaljord 12y ago
Martini is slow, try again with Negroni which is the new lib by the author of Martini.
- SwellJoe 12y agoAren't they quite different creatures, though? It's clear that language is not the only determining factor, since Sinatra is so much faster than Rails, and the Node example is so much faster in a cluster configuration. If the experience of programming for Sinatra, Phoenix, and Martini are very similar, it's fair to compare them (though maybe benchmarks may not be super useful, given that the database layer is likely to be the bottleneck in most large site deployments rather than simple routing and other stuff being compared here). If Negroni is very different (I don't know that it is, but a brief perusal of the site for Martini and the github for Negroni indicates very different experiences) then it's possibly no more useful a comparison than Rails to Phoenix.
- nkozyra 12y agoPlus isn't Negroni made to specifically be more about middleware than a fully-featured framework? If you say use Negroni, you might as well say use net/http (which is fair enough, since it's a low-level framework in itself).
- Rapzid 12y agoSo, profiled the Martini bench and discovered it was doing a LOT of file operations. I looked in the code and found that it does that in dev mode. The benchmark sets the mode to "production". D'oh! Ok, so I profiled it again and guess what? Martini is STILL doing a lot of file stuff. It's in net/http.Dir.Open and I believe it has to do with how the middleware is setup. You can see a TON of time spent in runtime.cgocall which I believe is it waiting for a syscall to come back. Don't have time to look into it further today but I'd imagine clearing that up could possibly double the performance.