We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

phalcon performance benchmark question,vs raw php and other language!!

https://www.techempower.com/benchmarks/#section=data-r4

Framework Peak performance (higher is better) php 2,826

phalcon 786

Why performance drop a lot,just 1/4 php? bechmark source code : https://github.com/TechEmpower/FrameworkBenchmarks



13.8k

phalcon benchmark point just raw php 1/4

for example , a lot of ajax request to get json data, how can I improve performance

I presume your post references the Peak database-access responses per second, EC2 large, single query benchmark.

It is very hard if not possible to make a framework that uses classes and OO design that is going to be faster than php itself. The object orientation alone will add a layer, which will make the framework slower than PHP itself. In addition, any framework that is written for php uses php itself, therefore the results are not surprising.

Whatever we have done is with performance in mind. The speed that Phalcon has is as fast as we can get it at. Still we are constantly researching ways to make it faster, so our journey is not done by a long mile :)

What you should be comparing is Phalcon against any other php framework. That shows where Phalcon's true power is.

Now if you don't want to use any object orientation, you will probably have the fastest application but you will have trouble maintaining it (one of the reasons why object oriented programming is preferred for applications).

Finally in the JSON serialization test (last one) you will see that Phalcon is more than twice as fast as any other framework, so its speed is there. However like I wrote above you can always use raw PHP to do the job.



13.8k

First Thank you very much! Phalcon is a good Framework . Most of job that I want to use Phalcon, but if a small part of the work I use raw php , how can I organize the two-part code. if I can do this , The whole system has better scalability, avoid Individual performance bottlenecks



13.8k

In addition, has phalcon user custom global methods? Can php raw use phalcon method? use XXXnamespace do it?



13.8k

Perhaps it does not change the original framework,just add a shortcut. It would be more flexible



98.9k

I don't think using raw php is really a smart option, unless you're doing something very simple... We're using frameworks because we want to organize better our application, have a philosophy of work, reduce the development time, make use of patterns of design, make the code more testable, use OOP programming with all its benefits, use a common structure with a community, frameworks provide built-in security, reduce the number of bugs, have an elegant architecture, increase reusability of code, etc.

Using Raw-PHP is coming back to the old years where PHP was a mix of sql, html and php, making the application less maintainable, making undesirable to work in an application, leading to bugs hard to detect, opening the door to security problems, etc.

Regarding the benchmarks, It's sad to see how most of the PHP frameworks are always in the latest positions specially the most robust ones, only the very basic are getting good results. Some frameworks are using direct raw access to databases or a database gateway (micro orm), giving good/bad results, Phalcon is compared using a full ORM like Doctrine (in Symfony/Silex).

If you compare:

Database-Server: Mysql Object Relational Mapper (ORM) classification: Full

You'll see that Phalcon seems to be the fastest full ORM in the PHP world so far.

In defense of the PHP world, I could say that all PHP frameworks must be loaded in every request, run the test and unload all the resources allocated, in counter part, some of the frameworks/tools tested are the webserver themselves, which gives an advantage that PHP does not have.



13.8k

Yes,php raw has ORM slower than phalcon



777

By using raw php, you are loosing all the benefits a framework has to offer, which in my opinion is not worth the extra speed (unless you are developing an extremely simple application.) Phalcon is pretty much the closest you will ever get to having the best of both worlds.