3 ms·
I don't really understand that benchmark. How can swoole (#11), written in PHP, be faster than PHP itself (#125)?
by paulintrognon 7y ago
I don't really understand that benchmark. How can swoole (#11), written in PHP, be faster than PHP itself (#125)?
- oaiey 7y agoBecause Swoole is a framework with an independent HTTP server and mysql driver. If you get rid of this two, it is just the algorithmic power of the runtime of PHP which factors in here. swoole is co-routine based, having a much better lifecycle and resource sharing as a consequence. Which leads to much more throughput.
- fraktl 7y agoSwoole hijacks network I/O from Zend Engine. Thus, it's capable of performing async I/O while keeping the userland code the same. What the benchmark shows is what happens when there's non-blocking I/O when speaking to the DB. PHP's problem is its synchronous nature, but Swoole easily bypasses that limitation. Btw. Swoole is not written in PHP. It's C++. It's compiled as an extension for PHP.
- Thaxll 7y agoBecause it's not PHP it's C++.