by jrockway · 17y ago · 0 comments
This seems like a bad reason: http://shootout.alioth.debian.org/u64q/benchmark.php?test=al...
PHP even uses more memory than Java on some benchmarks, which is pretty damn impressive. You have to work quite hard to use more RAM than Java.
(You'll also notice that source size of PHP is not much smaller than the equivalent Java program. PHP is a very verbose programming language compared to its other "dynamic language" brethren, and even to non-"dynamic" langauges like Haskell.)
I've got half of a CMS under development that's just recently -- sadly -- topped a thousand lines of code. It has a built-in parser for its own human-readable configuration file, which it has to parse every time; it has built-in cache management; it merges templates; it handles recursion for nested templates; and it does on-the-fly high quality image resizing. All of my out-and-back server response times are well under 1 second for all this work.
I'll look around and see if there are other trustworthy benchmarks that corroborate this.
EDIT: Yeah, IEEE disagrees: http://www2.computer.org/portal/web/csdl/doi/10.1109/ICWS.20...
I'm not surprised by PHP's memory usage, actually; I long ago figured it must be enormous just based on the way it handles data types. I don't think the shootout link is deliberately deceptive; rather, all the tests that I looked at were massively recursive, and this is not a task for which PHP was designed -- I think I would expect Java to perform better in those cases.
As a matter of simple honesty please tell us how many tests you looked at - I think we can all agree that binary-trees is massively recursive.
Did you look at what the programs do before announcing that "it kinda smells"?
Did you look at the "really interesting link" enough to realize the benchmarks game website is written in PHP?
Did you look at that particular web page enough to see "PHP is rarely the bottleneck (HTML slides)" ?
What difference does this make?
Did you look at that particular web page enough to see "PHP is rarely the bottleneck (HTML slides)" ?
This is just random user-generated content; every language on the site gets to link to whatever they want.
(As an aside, I am tried of the "my app can be slow because the database is slow". If you are not Doing It Wrong, your database is not slow, and your app can do other things while waiting for IO.)
None of them were a substantive response to the results of the graph.
When being presented with data, you should answer with more data, not conjecture.
So when you say "it doesn't match my experiences with PHP at all" are you talking about your experience writing planetary simulations in PHP?
> When being presented with data...
You presented opinion not data.
> all the tests that I looked at were massively recursive
Name them.
True, but in a web scenario, once a PHP script finished running it's completely removed from memory - so PHP usually ends up using less memory than other languages, since memory leaks don't get a chance to do that much damage.
As for verbosity, PHP5's object model makes it possible to write PHP that's almost as verbose as Java (eg the code in this article) but you don't have to. You can write PHP that's comparable to Ruby & Python in size (if not in elegance).
Not if you want to maintain it.