Modern frameworks comparison
2012-01-18How many times were you curious which one of, modern web frameworks is the best? For developers who have their favourite, answer is simple. But there are plenty of questions from begginers or devs who want to learn new technology, wondering which one should take, to stay on the edge.How many times were you curious which one of, modern web frameworks is the best? For developers who have their favourite, answer is simple. But there are plenty of questions from begginers or devs who want to learn new technology, wondering which one should take, to stay on the edge.
I code in Symfony (PHP) since 2008 and this one is my favourite. But from time to time I have opportunity to use some other technology. I wrote my master thesis project in Django, and found it very handy and sexy. Lately I’m doing a little bit in Ruby On Rails. I never coded in Ruby. It was always a little bit awkward language for me. But since I tried it, I really appreciate it.
If you ask me, which one is the best – I can’t point one, all of them are very good. But let’s try to measure frameworks. For purpose of this article, I created three applications in Symfony2, Django and Ruby On Rails. All those apps do the same – show two tables, one shows top USA cities (by population), second shows US states with highest number of big cities (above 100k citizens). I don’t want to measure frameworks by echoing „Hello world”, because it’s pointless. Assumptions:
- each application uses same fixtures – cities and states (provided by sql script),
- applications uses sqlite3 database
- applications uses default ORM (Doctrine2 for Symfony, Django ORM and Active Record for RoR),
- queries are as optimized, so one view uses two queries,
- html is rendered by built-in templating engine,
- every float number in template is rounded to one decimal place and formatted thousands with comas.
Applications
Framework | URL | Code |
---|---|---|
Symfony2 | symfony2.cities.sznapka.pl | github.com/wowo/cities-symfony2 |
Ruby On Rails | rails-thin.cities.sznapka.pl | github.com/wowo/cities-rails |
Django | django.cities.sznapka.pl | github.com/wowo/cities-django |
Performance test
The performance was measured by linux CLI program ab. Each test were ran with concurency level 15 and for 240 seconds.
ab -c15 -t240 http://URL/
The result is shown in below table.
Framework | Environment | Requests per second [#/sec] (mean) |
Time per request [ms] (mean) |
---|---|---|---|
Symfony2 | Apache2, PHP 5.3.5 | 53.85 | 18.569 |
Ruby On Rails | Thin, Ruby 1.8 | 35.51 | 28.159 |
Django | FCGI, Python 2.6.1 | 17.99 | 55.591 |
UPDATE: there are some more accurate test results (with better environments): http://blog.sznapka.pl/always-use-most-latest-versions-for-benchmarks/
Lines of code
This factor could be tricky. Lines of code not always tells if the code is better or not. To measure that, I used sloccount, Linux program, which also calculates cost of creating this code based COCOMO method.
Framework | Lines of code | Schedule Estimate (Months) |
Estimated Cost to Develop |
---|---|---|---|
Symfony2 | 229 | 1.94 | $ 5,747 |
Ruby On Rails | 51 | 1.06 | $ 1,187 |
Django | 135 | 0.29 | $ 3,300 |
As you can see, with Rails you need the least number of lines of code, but with Django you will do it fastest.
Community
All of measured technologies have strong and mature communities. They are well documented and has regular, stable release cycle. Only factor, that can be compared is community interest on Github.
Framework | Watchers | Forks | Opened issues | Opened pull requests |
---|---|---|---|---|
Symfony2 | 3763 | 967 | 231 | 54 |
Ruby On Rails | 12004 | 2615 | 674 | 217 |
Django* | 3264 | 633 | N/A | 55 |
* Please note, that Django repo is only SVN mirror
Ruby On Rails dominates in this section. Base on watchers, it has 4 times bigger community than other solutions.
Summary
As we can see in above comparisons, we can’t clearly determine which framework wins this comparison. Symfony2 is the fastest one, Rails has the biggest community and is cheapest to develop and Django has lowest Schedule Estimates. If you want to discover the most suitable solution for you and your project, you need to try those by yourself.
If you want to contribute, please write app in your favourite framework, which does excatly same as those above, share the code on Github, and let me know, I’ll be happy to extend this comparison.
I code in Symfony (PHP) since 2008 and this one is my favourite. But from time to time I have opportunity to use some other technology. I wrote my master thesis project in Django, and found it very handy and sexy. Lately I’m doing a little bit in Ruby On Rails. I never coded in Ruby. It was always a little bit awkward language for me. But since I tried it, I really appreciate it.
If you ask me, which one is the best – I can’t point one, all of them are very good. But let’s try to measure frameworks. For purpose of this article, I created three applications in Symfony2, Django and Ruby On Rails. All those apps do the same – show two tables, one shows top USA cities (by population), second shows US states with highest number of big cities (above 100k citizens). I don’t want to measure frameworks by echoing „Hello world”, because it’s pointless. Assumptions:
- each application uses same fixtures – cities and states (provided by sql script),
- applications uses sqlite3 database
- applications uses default ORM (Doctrine2 for Symfony, Django ORM and Active Record for RoR),
- queries are as optimized, so one view uses two queries,
- html is rendered by built-in templating engine,
- every float number in template is rounded to one decimal place and formatted thousands with comas.
Applications
Framework | URL | Code |
---|---|---|
Symfony2 | symfony2.cities.sznapka.pl | github.com/wowo/cities-symfony2 |
Ruby On Rails | rails-thin.cities.sznapka.pl | github.com/wowo/cities-rails |
Django | django.cities.sznapka.pl | github.com/wowo/cities-django |
Performance test
The performance was measured by linux CLI program ab. Each test were ran with concurency level 15 and for 240 seconds.
ab -c15 -t240 http://URL/
The result is shown in below table.
Framework | Environment | Requests per second [#/sec] (mean) |
Time per request [ms] (mean) |
---|---|---|---|
Symfony2 | Apache2, PHP 5.3.5 | 53.85 | 18.569 |
Ruby On Rails | Thin, Ruby 1.8 | 35.51 | 28.159 |
Django | FCGI, Python 2.6.1 | 16.38 | 61.066 |
Lines of code
This factor could be tricky. Lines of code not always tells if the code is better or not. To measure that, I used sloccount, Linux program, which also calculates cost of creating this code based COCOMO method.
Framework | Lines of code | Schedule Estimate (Months) |
Estimated Cost to Develop |
---|---|---|---|
Symfony2 | 229 | 1.94 | $ 5,747 |
Ruby On Rails | 51 | 1.06 | $ 1,187 |
Django | 135 | 0.29 | $ 3,300 |
As you can see, with Rails you need the least number of lines of code, but with Django you will do it fastest.
Community
All of measured technologies have strong and mature communities. They are well documented and has regular, stable release cycle. Only factor, that can be compared is community interest on Github.
Framework | Watchers | Forks | Opened issues | Opened pull requests |
---|---|---|---|---|
Symfony2 | 3763 | 967 | 231 | 54 |
Ruby On Rails | 12004 | 2615 | 674 | 217 |
Django* | 3264 | 633 | N/A | 55 |
* Please note, that Django repo is only SVN mirror
Ruby On Rails dominates in this section. Base on watchers, it has 4 times bigger community than other solutions.
Summary
As we can see in above comparisons, we can’t clearly determine which framework wins this comparison. Symfony2 is the fastest one, Rails has the biggest community and is cheapest to develop and Django has lowest Schedule Estimates. If you want to discover the most suitable solution for you and your project, you need to try those by yourself.
If you want to contribute, please write app in your favourite framework, which does excatly same as those above, share the code on Github, and let me know, I’ll be happy to extend this comparison.