Phalcon Zephir vs. APC vs. HHVM Performance

I started reading about HHVM and Zephir. At first I was very excited that thanks to these technologies it jumps out. But then I started asking myself a question. If it really gives you that kind of performance, as the owners of these technologies say.

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

PHP script Live process: Run Script β†’ Compile β†’ Run Script

The obvious problem here is compilation. We need to compile our Script every time it was launched.

Suppose I have Apache2 installed and I run my php Script named "test.php" with:

APC: APC is enabled and the APC option is for checking changes. It should look like this:
Run Script -> Run Script
Because it has already been compiled into our memory and is ready for use.

HHVM: Hip Hop Virtual Machine, will behave similarly to APC. The difference here is that the virtual machine, which for standard PHP with APC is Zend Engine. The way it is:
Run Script -> Run Script
Because it has already been compiled (in memory?) And is ready for use.

Marshmallow: I compiled the Script to C extension. So I don’t need to compile? (I'm not sure about that). Thus, the functions inside my PHP script are now native. So, if I write another Script named "test2.php" that will run my own functions that were in "test.php" (yes, it should be in .zep format, but at the moment it doesn't matter) . Now, using APC, I am avoiding compilation.
Run Script -> Run Script

And now I'm embarrassed. As far as you can see it is all the same now. I do not see any advantages of using Zephir and HHVM over standard APC. So I would like to hear if I am right or totally wrong?

+5
source share
3 answers

Zephir cannot process high-level object-oriented code. The speed of your application will be worse than the pure PHP method.

Here you can find a comparison of pure PHP vs Zephir. https://github.com/dgafka/zephir-BookStore

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

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

+2
source

Zephir is pretty fast (of course, since it is compiled with the C extension)! https://www.simonholywell.com/static/files/2014-02-28/index.html

Hack is pretty fast too, smaller than Zephir, but on the other hand, it is much more mature / active / documented than Zephir.

The main advantage of using Zephir / Hack is that you get static typing as a bonus. This is a real relief to add such security to your PHP code.

Dynamic typing has its limits and allows too many ugly / dangerous things.

0
source

Use Zephir for abstract functional coding.

For example, a library of functions that executes string formats specific to your project. All pre-PHP OOP (business logic) and such should be run in PHP.

Just!
Use the appropriate tool for the project.

0
source

Source: https://habr.com/ru/post/1208390/


All Articles