Posted by Fred Wu
This is just a quick and dirty test, please take it with a grain of salt.
We all know that CodeIgniter is a very fast framework, but how about Kohana? Kohana is packed with more features, so does that mean it is slower? Let’s find out.
The following benchmarks are done on my local Macbook Pro machine (C2D 2.4GHz + 4GB), Leopard 10.5.2, MAMP without any code optimisers or caches.
Because I don’t have *that* much free time, the tests are very simple. I created a simple database with three tables, and the application is going to insert data into the three tables separately, retrieve them in one single query with query binders (or ‘active record’ classes per CodeIgniter’s term) and then clean up the database tables. I’ve also included use of a text helper method: limit words, which is presented in both Kohana and CodeIgniter. Total number of SQL queries: 2204.
I have benchmarked against three applications: CodeIgniter 1.6.1, Kohana SVN (rev 2328) and Kohana 2.1.1.
First of all, let’s see what the profilers told us:
CI 1.6.1: 0.5657s
K SVN: 0.5718s
K 2.1.1: 0.5787s
Memory usage (pre-controller)
CI 1.6.1: 642,136 bytes
K SVN: 1,097,976 bytes
K 2.1.1: 1,076,972 bytes
Memory usage (post-controller)
CI 1.6.1: 2,354,524 bytes
K SVN: 3,062,376 bytes
K 2.1.1: 3,026,884 bytes
As you can see, Kohana consumes a lot more memory than CodeIgniter, but their execution times are on par.
Let’s then remove the database functions and just loop through three paragraphs of Loren Iipsum text with the word limiter for 20,000 times, and use ab to test it for 100 times.
Results the lower the better (total time taken).
CI 1.6.1: 110.236098 seconds
K SVN: 130.211059 seconds
K 2.1.1: 130.662462 seconds
Finally, let’s do a ‘hello world’ with ab -c 10 -t 60 (10 concurrent users for 60 seconds). We assign ‘hello world’ to a view variable and pass it onto a blank view page.
Results the higher the better (requests per second).
CI 1.6.1: 122.18 [#/sec]
K SVN: 113.96 [#/sec]
K 2.1.1: 118.54 [#/sec]
As a comparison (just for fun), here are two results for CakePHP:
First run: 18.66 [#/sec]
Second run: 33.47 [#/sec]
The first run was done in default set up whilst the second one was done by using suggested tweaks. CakePHP is in a different league to CI and Kohana in my opinion. In both CI and Kohana, models are optional, but CakePHP revolves around models.
Once again, these tests are just for fun.
- Ruby on Rails, Passenger (ModRails) vs CodeIgniter and Kohana (15)
- Using Zend Framework with CodeIgniter (48)
- Notes on Choosing a PHP Framework: A Quick Comparison of CodeIgniter and Kohana (52)
- Choosing a PHP Framework Round 2: Yii vs Kohana vs CodeIgniter (62)
- Yii Kohana Bridge updated: full Kohana flavour now added! (2)
This entry was posted on Tuesday, March 25th, 2008 at 2:11 am and is filed under CodeIgniter, Kohana. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.