Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
The PHP Benchmark (phpbench.com)
5 points by cruise02 on April 18, 2009 | hide | past | favorite | 7 comments


Interesting that the old using-double-quotes-is-slower thing is actually disproven. Actually it's slightly confusing as it should be slower - double-quoted strings are parsed to find inline variables - yet single-quoted strings are a tiny bit slower.

Any reasoning on this?


I'm a little disappointed by the creator of this site. While the idea certainly seems to be beneficial, I don't think it approaches the full potential by neglecting other languages.

While PHP is, effectively, an awful language whose audience rather needs this tool, this should have been made available on a more global scale.


Getting a little sick of all the snobbery about PHP around here. PHP certainly isn't as elegant as say, Ruby or Python, and I definitely can't stick my nose in the air and call myself a "PHPista" like some "Pythonistas" I know, it gets. The job. Done.

PHP has an incredible library backing it up, is specifically engineered for the web, and is understood by a tremendous amount of people. There are code samples, tutorials, and all kinds of things just flat-out solved already for you.

And frankly, EVERY audience could seriously use some benchmarking information. I'm certain there are constructs in every language that are miles apart in terms of efficiency.


I think the intention is to compare methods within the language itself, rather than to other languages.


Right. I think this should be made available for other languages as well.


I couldn't find what version of PHP he was testing anywhere on the page. However, the second test ("Using the =&-ref-operator") makes me think he isn't testing PHP 5. This functionality was deprecated and, if error reporting is turned up, will cause an E_STRICT error to be thrown.


In the case of "Counting Loops", PHP is slower because it actually calls the count() function for each iteration.

Conclusion? Use foreach loops instead, which are the fastes. :)




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

Search: