Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> More readable and writeable, and probably more popular in the past fifteen years.

You're confusing PHP's general popularity for web development with it's popularity as a command-line scripting language. There's no way PHP is more popular than Perl for non-web scripting. Unlike Perl, PHP was never designed as a general purpose language.

Try writing a PHP script which has to parse command line options. It ain't pretty. Python, Ruby and Perl were designed for this. PHP was not.

PHP is extremely fast for scripts written in raw, procedural PHP but its shared nothing design makes it a liability with large frameworks such as Laravel and Symfony. In many tech empower benchmarks Django and Rails are listed ahead of Laravel.



> Try writing a PHP script which has to parse command line options. It ain't pretty. Python, Ruby and Perl were designed for this. PHP was not.

Worked just fine at the job where we had a ton of serverside daemons. You're saying like splitting a few strings and putting them in a dict is black magic, and as if Python, Ruby and Perl don't use some libs for that, which (hopefully) evolved over some time.

> its shared nothing design makes it a liability with large frameworks such as Laravel and Symfony. In many tech empower benchmarks Django and Rails are listed ahead of Laravel.

A wild arbitrary goalpost appears! Even if Python is in any way comparable to PHP in ongoing execution (which I would like a lot but can't believe due to having some experience with that), we were talking about scripting, for which startup time with slim code matters, not ongoing performance with big frameworks. Cold startup time of Python is bad.

Checked now for good measure: turns out PHP 7 from MacOS isn't much faster than Python either from the system or from Brew, on a “Hello world”. However on a machine with a slow CPU PHP takes the lead; and especially PHP 8 is more than three times faster than Python. This vaguely contradicts my past experience on Linux, where I was never able to make Python as fast—maybe something iffy is going on specifically on Mac.

(However Perl does beat PHP by a lot, and even beats Lua on the slow machine—seems my latent hopes of using it for scripting were right, and I'll mourn its disappearance even more.)


Benchmark on Mac(or Windows) is hard.

You really have to know how it works to know what you're actually benchmarking, and if the numbers are even remotely related to what they would be on Linux. Unless the plan is to actually use in on Windows/Mac, ofc.


Option-parsing libs in Python, Ruby and Perl exist for a reason. There's more to it than "splitting a few strings and putting them in a dict" but if you don't know what you don't know stick with PHP.


> PHP is extremely fast for scripts written in raw, procedural PHP but its shared nothing design makes it a liability with large frameworks such as Laravel and Symfony. In many tech empower benchmarks Django and Rails are listed ahead of Laravel.

That's not a flaw of PHP, it's the only correct design for a largely stateless and request-based thing like a web page. The flaw is the second-system effect of people thinking they needed a "framework" instead of a library, and producing something that can't have reasonable performance.


I benchmarked Laravel, Django and Symfony a year ago in a rather minimal setup on all three. From what I can remember, Laravel was a good amount faster than Django, and Symfony a bit faster than Laravel.

Take this and a basically every other benchmark with a huge grain of salt as the frameworks have quite different functionality enabled/installed out of the box.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: