Why Yii?

Last time I was talking about how great CodeIngniter is. Still if you've tried both CI and Yii you might find few notable advantages over against CI:

- enough module-based architecture - much better work with views/layouts/partials/widgets - more advanced ORM/ActiveRecord/ActiveForm - more necessary core-in functionality: commands, migrations & etc

So... Yii is a high-performance framework. The graph below shows how efficient Yii is when compared with other popular PHP frameworks. In the graph, RPS stands for "request per second" which describes how many requests an application written in a framework can process per second. The higher the number, the more efficient a framework is. As we can see that Yii outperforms all other frameworks in this comparison. The performance advantage of Yii is especially significant when the widely used APC extension is enabled.

Performance alone is not the whole story (otherwise we should all use plain HTML or PHP). With such superior performance, Yii still provides a very rich feature set which can greatly improve your development efficiency.

Why Yii is so Fast

Yii is so much faster because it is using the lazy loading technique extensively. For example, it does not include a class file until the class is used for the first time; and it does not create an object until the object is accessed for the first time. Other frameworks suffer from the performance hit because they would enable a functionality (e.g. DB connection, user session) no matter it is used or not during a request.

The testing environment is as follows:

Operating System: Red Hat Enterprise Linux Server release 5.2
Web Server: Apache httpd 2.0.40
PHP: 5.2.6,
any non-essential extensions are disabled
CPU: Dual Intel Xeon 3.2GHz
Main Memory: 2GB
Hard Drive: 73GB 15K RPM SCSI/SAS HDD

The APC ini settings are as follows:


Click to share thisClick to share this