Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm wondering, if several engineers spent months porting their php code to hiphop, wouldn't they be better off just rewriting critical parts of their code base to c++?


If HipHop supports 99% of PHP 5.3, then it took them months to change 1% of their code. Changing any more than that would have obviously taken longer, especially to a whole other language.


I would like to elaborate a bit on this. Currently, Hiphop supports 99% of the PHP 5.3 features. When we started working on Hiphop, less was supported.

Stuff like closures, eval(), create_function(), constants with dynamic names (e.g. defining constants from an array) and class destructors were all not supported. Some more subtle stuff: you cannot use current() to get the first element of an array in Hiphop, class_exists() always returns true.

We also had to port our custom PHP extensions.

Finally, we spend a lot of time on related stuff such as precompiling all Smarty templates (so that the generated PHP gets translated to C++ too), using Hiphop's daemon system and setting up compile, build and deploy systems.


Willem, how much of the performance improvement was related to Smarty templates being compiled to C++ vs. the application itself?


We did not measure this separately. With Hiphop, you compile a bunch of PHP files to a binary executable file. Once you have this file, you cannot load any new PHP files like you can with vanilla PHP. So including the Smarty templates is kind of mandatory.


Aha I see. Thnx for the follow up.


Please god no! Have you seen the type of code written in PHP? Do you really want more shitty C++ code to be created???




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: