5 ms·
I posted some generally supportive comments on his post, but dared to point out that PHP's interpreter is in fact rather slow compared to pretty much everything
by compay 15y ago
I posted some generally supportive comments on his post, but dared to point out that PHP's interpreter is in fact rather slow compared to pretty much everything else, so he shouldn't claim that PHP has "maybe the best speed and scalability among script-based languages." I ended up getting attacked as some kind of PHP hater.
If PHP has a reputation as a ghetto, it's in part because of cocksure noobs like this who think they know everything and are impossible to have a rational conversation with.
- katzgrau 15y agoI am said "cocksure noob." If you disagree with @compay, you will assuredly earn the same title.
- jbm 15y agoWho are you? I don't mean that in an insulting fashion, I simply don't know. (Compay has a karma of 1426 for comparison, and I owe him for introducing me to the PIE library for IE CSS)
- jessedhillon 15y agoWelcome to Hacker News! Based on your comment and that you have a tenth the karma of the person you're accusing of being reactionary, I would recommend that you make an actual argument or mount a defense, and stay away from these kinds of insults.
- katzgrau 15y agomeh, read the comments on my blog and think for yourself instead taking some collectively-generated number as an indicator of whether you should scowl at me or not.
- deleted 15y ago[deleted]
- roel_v 15y agoBut what are you comparing, the interpreter or run speed of bytecode? I haven't seen any comparisons between languages for several years, but PHP used to be fast for its class, and I can't think of many reasons myself of why that would've changed (doesn't mean it hasn't, but I'd like to see some evidence).
- compay 15y agoObviously benchmarks have their deficiencies. I'm referencing one of the most standard, frequently cited set of benchmarks for programming languages but make no claim that they're perfect. You can read all about them here: http://shootout.alioth.debian.org/ http://shootout.alioth.debian.org/ There's a very obvious reason why a language may be relatively fast today and relatively slow tomorrow - namely, other languages continue to be developed as well. And now, here's what the point of my comment is. I assume you work with PHP and are unhappy hearing that it's slow. Well, I work primarily with Ruby, which in general is even slower, so don't take offense. :) Let's take a look at the context of this conversation. You haven't seen any evidence of its relative speed for "several years," and haven't even given the issue enough thought to discover the most obvious reason why its status may have changed, and yet in the face of somebody offering evidence (I did on the OP) are reluctant to accept the possibility that PHP is slow. I've programmed in PHP for around 10 years, starting when 3.0 was in beta up until the first few releases of 5.x, and in that time I've seen many, many PHP developers with this attitude. This is a general problem of the PHP community: Zend has done a fantastic job marketing PHP, and PHP has been used on so many high profile projects, that developers just assume PHP is "blazing fast," when that's simply not the case. Now, before I get attacked as a PHP hater again, let me point out that even though I prefer to work with other languages now I am by no means a PHP hater. I just recommended a PHP solution over a Ruby one to a potential client, because in their business context I thought it made more sense and couldn't in good faith sell them a technical solution that wouldn't meet their needs as well just because it used my current favorite language. I'll also explain where PHP is quite fast. A lot of the functionality in PHP is just a very, very thin wrapper on top C library calls, and has very little overhead. This is why things like math operations are generally quite fast. Facebook's Hip-hop compiler, which precompiles PHP to C++ and then compiles it to native binary, produces code which on some benchmarks performs worse then the original PHP code because of this fact. But the parts of PHP which aren't just delegated to C code are in general very slow. Consider, for example, a benchmark that's heavy on array traversal. Take a look at PHP compared to other languages and see how incredibly badly it performs compared to everything else: http://shootout.alioth.debian.org/u32/benchmark.php?test=binarytrees&lang=all http://shootout.alioth.debian.org/u32/benchmark.php?test=bin... TL;DR: 16 minutes for PHP and 268.15 seconds for Ruby 1.9. If you want to bitch about the fact that that benchmark includes the time it takes PHP to compile the code, well, then subtract roughly 0.1 seconds from PHP's time, but also do it for Ruby since Ruby's benchmark also includes compile time. Opcode caching isn't going to save you here. Think about this for a second: what do you use more in a web development context: math operations, or array traversal? Just think how much time your web apps spend looping over database result sets. See what I mean? PHP may certainly be "good enough" but please just stop saying it's the fastest thing out there unless you can show me some proof. If the PHP community had more of a backbone and stopped believing untruths like "our docs are the best in the business" and "PHP is the fastest scripting language" then Zend would be forced to do something about it. The fact that the language, the interpreter, and all the soft infrastructure around it are such a mess is not because Rasmus or Zeev or Andy are incompetent, it's because for years they've had such an incredibly unskeptical community of "true believers" that never holds their feet to the fire on anything. Stop being a true believer. Insist on something better. Bitch and complain if you have to. That's how to improve the programming language you love to use.