Today a thought provoking benchmark was published at Hacker News: http://www.techempower.com/blog/2013/03/28/framework-benchmarks/. It compares several web frameworks and how they perform.
How well does onion perform?
I did a fast test program with onion to check how good is the performance compared to the other frameworks. The code is at https://gist.github.com/davidmoreno/5264730. Instructions to compile and execute the test are on the gist itself.
This test only checks the simple json code, and the database but using sqlite for 1 and 20 requests. Database dump is at http://www.coralbits.com/static/world.sql. As onion is not a framework, there are no facilities for using the database comfortably, just the plain sqlite3 API, which is OK depending what do you want to do.
The results are, on my Intel(R) Core(TM) i7-2677M CPU @ 1.80GHz:
8426.56 Sqlite 1 petition
515.42 Sqlite 20 petitions
This is just one execution, the laptop is just doing everything as normal, including spotify on wine playing the Inception soundtrack.
For comparison, I could only run the JSON test on the nodejs example they provide at https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/nodejs:
4983.75 JSON nodejs
As you can see onion has about 10x better performance than nodejs. Extrapolating the performance I get on nodejs, I should be able to get 17359.67 using netty on my laptop, the best in their benchmark. This means onion should be about 3.25 times faster than the best framework of these benchmark for this specific test. More work is needed on my computer to make the other tests work.
But onion is not a framework. Or at least not a complete one. It needs at least an ORM.
Does this makes sense?
Anyway I think comparing benchmarks this way misses several points, especially when it says that performance is the most important, not even talking about the ease of developing on such framework.
For me its more important the balance between the speed of development and performance on hardware, with normally more weight on the development speed. A full web application done in C o C++ will be really performant, but it will suffer higher development costs, development time and quite probably bugs. Finally it will be very expensive. On the other hand one made in Python or Ruby will be much easier to develop but will be a worse performer. It depends on the project that the balance should be on one side or the other. What you save on hardware you pay in developers. It depends on your size, budget, and scope whether you should go for one or another direction.
I would never ever use onion for a full web application development, but for specific services where performance is critical, its a very good option. Also on systems where a full framework is too much overhead, use of a leaner alternative like onion is the way to go.