Sep 25 2011

PHP vs. Django

sas

This week I found an impressive chart on the web that illustrates the power of php frameworks. This benchmark shows how many requests per second a very simple web application can deliver. The test is targeting on the basic overhead of the framework, things like bootstrap initialization etc. This kind of overhead which every request have. So this benchmark is provided by the Framework Yii, and what a surprise, this framework is the best of all in this benchmark.

So far so good. The question that I ask myself was, how fast a django application (based on python 2.7), which also deliver this simple “hello world” will be?

I created a very basic simple django 1.3 application for testing the performance. I included this application into the code base from the upon drescriped benchmark application. The whole code is available to my github repository (including the code providing from yii).

Here are the interesting results (Requests per Second):

PHP Frameworks vs. Django

 

Framework [#-Requests/sec] (mean)
cakephp-1.3.4 30.34
symfony-1.4.8 45.89
zend-1.10.8 60.15
yii-1.1.4 100.48
codeigniter-1.7.2 143.72
django-1.3 431.76

Operating System: Kubuntu 11.04The testing environment is as follows:

  • Web Server: Apache/2.2.17 (Ubuntu)
  • PHP: 5.3.5-1ubuntu7.2
  • CPU: Intel Core2Duo P8600 2.4 GHz
  • Main Memory: 4GB
  • Hard Drive: 300GB SATA HDD

Jan 5 2011

PHP function benchmark

sas

If you are not sure which function have the best performance you can look up this at phpbench.com and find the best performance function call.

In my case i wanted to kwow how fast are the functions isset() and empty(): the result is they are exactly equal fast.