PHP has high development efficiency and fast speed. This advantage is recognized by everyone, so can PHP become faster? sure!
People have Node and Go, and PHP also has Swoole. When Swoole takes over the life cycle of PHP and solves synchronous IO blocking through coroutines, PHP shows its flexibility and performance beast. side.
In other words, the Swoole engine has asynchronous coroutine support, so the network and other IO performance of the PHP service will be very good.
If your PHP code runs in the PHP7/8 Swoole environment, the performance of the PHP service will be very explosive. Good underlying support, logical memory resident, and asynchronous coroutine support can basically satisfy the needs. Performance requirements for most scenarios.
If your code runs in a CGI environment (such as PHP-FPM), although the service process is resident in memory, the PHP code logic will not be resident in memory. At this time, a request Once in the life cycle, performance will definitely be affected, but this stateless mode is very similar to HTTP and is quite stable. It is the most common operating mode of PHP. Modifications to the code take effect immediately and hot deployment can be easily achieved. In short, it has advantages and disadvantages, and it is very It’s hard to have the best of both worlds.
So the PHP performance problems that many people complain about are not the real problems of PHP. They can only be said to be a choice. The design of PHP is like this, and Swoole provides another choice for you to see. PHP's concurrency performance is powerful. People always want to have more choices and like to choose more...
PHP does not have a JIT yet, and it does not have a father like Google. For backward compatibility, the function names are confusing and there is no improvement. These are the existing shortcomings of PHP. Everyone can point them out, but the great thing about PHP is that it is a masterpiece contributed by many open source people regardless of return. Brother Niao also said , the people in the PHP development team change every few years, all based on amateur enthusiasm. No industry leader would appreciate the small remuneration offered by Zend, and JVM, V8, and Go were all created with a lot of manpower and financial resources. It is a grassroots miracle that PHP's popularity and share are not inferior to them, and it also shows that PHP can really help most people.
Recognize that language is just a tool. If it can achieve your success, you should be grateful for it. If you don't like it, there is no reason to discredit it.
I am also a front-end programmer. From native to jQ to Vue, I have also written Python and Go. However, the flexibility and efficiency of PHP have brought me more project achievements. I also feel that writing PHP is more convenient. Happy, that's all.
Original address: https://www.zhihu.com/question/266464148/answer/416197084
The above is the detailed content of Can PHP get any 'faster'?. For more information, please follow other related articles on the PHP Chinese website!