Search code examples
phpapachecompilationphalconhhvm

Phalcon Zephir vs APC vs HHVM Performance


I started to read about HHVM and Zephir. I was very excited at first, that performance jumps up thanks to this technologies. But then I started to ask myself a question. If It really gives you such performance like owners of this technologies says.

Now I am going to say, how do I think it looks like. Correct me, if I am wrong.

Php Script Live Process: Run Script -> Compile -> Execute Script

The obvious problem here, is with compiling. We need to compile our script every time it has been started.

Let's pretend I have Apache2 installed and I am running my php script named "test.php" with:

APC: APC turned on and APC option to check for changes off. It should looks like that:
Run Script -> Execute Script
Because it's already compiled to our memory and ready to use.

HHVM: Hip Hop Virtual Machine, would behave similar to APC. The difference here is, virtual machine, which for standard PHP with APC is Zend Engine. So it goes like that:
Run Script -> Execute Script
Because it's already compiled (in memory?) and ready to use.

Zephir: I compiled my script to C extension. So I guess it doesn't need compiling? (I am not sure about this). So the functions inside my php script are native ones now. So, if I write another script named "test2.php", which will run my native functions which were in "test.php" (Yes it should have .zep format, but it doesn't matter for now). Now using APC I avoid compiling process.
Run Script -> Execute Script

And now I am confused. As far as you can see it's all the same now. I dont see any kind of advantages of using Zephir and HHVM over standard APC. So I would like to hear, if I am correct or totally wrong?


Solution

  • Zephir can't handle high level objective oriented code. Speed of your application will be worse than clean PHP way.

    Here you can find comparsion of clean PHP vs Zephir. https://github.com/dgafka/zephir-BookStore

    So, if you want to rewrite your application to zephir, think twice before you will do it.

    https://github.com/phalcon/zephir/issues/694#issuecomment-67987616