Is php development fast?

(*-*)浩
Release: 2023-02-27 09:56:01
Original
2002 people have browsed it

Is php development fast?

PHP itself is very fast

PHP is often several times faster than Python or Ruby. PHP arrays are written in C and have to go through ten After several years of optimization, PHP's commonly used functions are also written in C. When operating arrays or calling these standard library functions, in addition to the calling overhead, the execution of the function itself is as fast as C. (Recommended learning: PHP video tutorial)

PHP framework is very thin

Many people don’t use the framework at all. They come in from FPM and go straight to the topic. No The redundant actions brought by abstract encapsulation, such as

URL routing, have been simply handled in Nginx, and there is no need to capture variables in the request path.

When you don’t need a session, it will not automatically obtain the session for you. The session is very important.

When there is no need for identity authentication, there is no need for the common auth processing flow in the framework.

There are no layers of beforeXXX and afterXXX, skipping a lot of HOOK methods.

Each of the common functions of the above frameworks has heavy initialization operations of the framework itself. Once used, it will seriously reduce performance. Nowadays, the more mainstream PHP frameworks, such as Laravel and Codeigniter, are typical representatives. The performance is roughly like this. A simple hello world, the QPS that each CPU core can afford

Next Generation PHP Running Mode

Less than 10% of PHP users choose Swoole when they particularly need performance and must use PHP. It is different from FPM. Swoole is essentially CLI operation, which requires time-consuming protocol analysis. and routine processing are all done in extensions written in C.

While Swoole inherits the high performance of PHP7, it also completely solves the defect of re-initialization of each request frame in FPM mode. Then while choosing Swoole, you can still use only a thin frame or even no frame. Will the speed take off?

In the operating mode of Swoole, you can think of PHP as a configuration file written in C. What is the reason why it is slower than those competitors? It should be faster than those opponents. If Laravel is adapted to Swoole, it will definitely be a different story.

From the perspective of development efficiency, for me personally, PHP is about 10% faster than Java. When I wrote it, PHP was faster, but it is a little more troublesome to modify. It requires sorting out arrays nested in several layers. The structure is not as convenient as jumping directly to the explicit type definition in Java. Coupled with the existence of the compiler, some low-level bugs are eliminated. Java has far more standard library facilities, documents and reference materials than Swoole, which narrows the gap in development efficiency.

The above is the detailed content of Is php development fast?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!