DEV Community

Discussion on: PHP 8 performance 🐘🐘🐘🐘🐘🐘🐘🐘🚀

Collapse
 
yoursunny profile image
Junxiao Shi

PHP used to be Personal Homepage Preprocessor and I'll continue to treat it as such. My main website uses PHP but it's only for rendering pages.

I would not make long running scripts out of PHP. It's what Node.js is for.

Collapse
 
yellow1912 profile image
yellow1912

PHP actually has better type checking, better support for OOP, and similar if not faster performance compared to Node. I use both of them at the same time for their purposes.

Thread Thread
 
yoursunny profile image
Junxiao Shi

I don't know about PHP8, but PHP7 indeed has good OOP.
As for type checking: you are not supposed to write JavaScript directly. Write TypeScript, compile and run in Node.

Performance depends on use case. Node would perform better on I/O intensive workloads; PHP would perform better if you don't need much I/O.
Neither would beat C++, but you would spend 3x coding time for C++.

Thread Thread
 
yellow1912 profile image
yellow1912

If you like the performance of C++, try the Swoole extension for PHP, it brings the Go Coroutine syntax and power to PHP :). You can start writing async code with PHP as well and get the same I/O performance you have with Node if not more.

In any case, the point is not to say which language is better, PHP can be used for serious work, it's not just meant for personal toy project anymore. Even if you do not want to give that a try, I hope that you should not spread out-dated information that may discourage new beginners to try it out. Both PHP and Node are fantastic languages and they can live happily together :).

Thread Thread
 
dakujem profile image
Andrej Rypo

How widespread is the hosting/platform support for Swoole? Do you run it in docker, kubernetes or something like that? I have yet to experiment with it. Though i lived the coroutines in Go. Still, Go is a pain in the ass to write. 😆

Thread Thread
 
yellow1912 profile image
yellow1912

If you can use pecl or run phpize to compile php then you can install swoole. It's no different than install other php extensions IMHO. I think you should have absolutely no issue on Amazon,, Google, etc...