Currently it places #11 on the famous framework benchmark:
https://www.techempower.com/benchmarks/#section=data-r18&hw=...
Currently it places #11 on the famous framework benchmark:
https://www.techempower.com/benchmarks/#section=data-r18&hw=...
In most cases, though, you care a lot more about the 95th or even 99th percentile response times than you do the mean; I'd trade quite a bit percentage-wise off my mean response time if it brought the 95th percentile way down.
(This isn't to hate on PHP; PHP is fine. But you shouldn't choose it because the "single query" benchmark says it's fast.)
Is it fair in the comparison? Nope. Comparing oranges with apples is always bad. The question however is whether you want an Apple or an Orange?
TechEmpower has to be read like that: plaintext ensures the HTTP server stack and the base runtime. Json is about json encoding and emitting. Single query and multiple query about streaming data through. The benchmark is gradually testing your platform. .NET Core was bad at Plaintext. Now they are top 10. Now they realized the default json library (Newtonsoft.Json) of .NET is very nice but too slow. So they built a new one (System.Text.Json). Now the PostgreSQL Driver sucks. So they find and support the driver project. Like that you built a platform which is top notch.
I think you confused "single query" with "single request". The goal of the benchmark is to make one query to the DB per request. The number of requests (clients) is in the hundreds of thousands.
#11 in Single Query is: Swoole, PHP, mySQL
Swoole => Not default PHP but a highly specialized framework Single Query => This is not about fast language/runtime but fast DB driver
While still definitely impressive, Techempower Plaintext is more specific (runtime + http server). Here Swoole/PHP is #60. The Swoole/PHP mysql driver (that is not default PHP mysql driver) is very optimized compared to e.g. the .NET Core postgreSQL driver. The result => Swoole/PHP is wicked fast (~ 15% delta) but .NET Core beats Swoole/PHP Plaintext (~ 75% delta).
Plain traditional PHP is not one of the fastest language/runtime. But Swoole is a wicked fast framework.
Good thing however: Indeed, the JIT will improve the PHP language/runtime. And Swoole shows what is possible if you make some radical design decisions (same what happened with .NET). And this is good for PHP.
swoole is co-routine based, having a much better lifecycle and resource sharing as a consequence. Which leads to much more throughput.
Btw. Swoole is not written in PHP. It's C++. It's compiled as an extension for PHP.