Yii2: Yii as C Extension

Created on 14 Sep 2014  Â·  11Comments  Â·  Source: yiisoft/yii2

Is there a plan to make yii as c extension just like what phalcon framework do ?

hard feature

Most helpful comment

Since PHP 7.0 release possible feature benefits does not cost the effots.

All 11 comments

There's no such plan to create and support C extension by core team but if one want to handle such project, we're absolutely for it.

It seems a good idea.

Can write it with Zephir.

What about maintaining it?

In fact, such an attempt, I've done, but because Yii2 use a lot more new features php5.4, restored to the C extension, it is difficult to achieve (of course, can be achieved, but more trouble, you need to modify the core source code in php support in line with the current yii2 consistent with), and, after opening opcache, performance and current yii2 no performance boost.

And because the future of the core focus of php, php optimization is resolved, rather than in the extension, that is, most of the new features, not related to treatment in the extension, and for historical reasons, the new Ministry of new features compile time can not be a better deal (there may be a memory problem).

The following example, as yii2 in yiibase\Widget.php

Widget.php has a static method is widget. If Widget.php written in C extension, for current php kernel, the compiler does not pass. Because the class and method names the same name may be seen as a constructor method, because php core reasons, when compiling the extension, it will no namespace, class names and method names, namely Widget widget class name and method name, so he would think this is a constructor, but the constructor can not be static, it will report the php kernel errors. But in the run parsing state, it is possible, of course, this problem is to modify the kernel php can be repaired, but the most important reason is that the performance did not improve much, so I temporarily abandoned. Where zephir in php-ng times, whether needs more improvement, still unknown.

@netyum you mean https://github.com/netyum/cyii2? Haven't seen it.

It definitely makes sense to start after final 2.0 release not to waste time on changes. Also it should be tested against PHP, PHP+Opcache and HHVM.

Yes, but the latest code in http://git.oschina.net/netyum/cyii2/
But for a long time are not maintained.
facebook php compiler has been proposed norms, so the future may not have a c-php and hhvm, provided that they meet specifications, there will be more php compiler and hhvm not just the fastest, some compilers will php projects for realization, may have better results.

let a hundred flowers bloom, a hundrend schools contend, the future will be faster php.

So do yourself on the right Yii。

Sure. We'll see what HHVM vs phpng will bring us. Thanks for valuable info.

@samdark BTW, zephir promoters or defenders should you come to own the same country, so you can have better communication.

It is really nice to know that Yii would support such a feature in the future. IMO its a must for today's large scale web apps.
I might not have enough info about the feasibility to implement this feature, so would anyone please explain in brief what are the steps required to complete this feature?
Thank you.

Since PHP 7.0 release possible feature benefits does not cost the effots.

Agree.

Was this page helpful?
0 / 5 - 0 ratings