Could you specify which $n you were using, and also provide the equivalent Perl script that you used?
Zeev On Sat, 29 Dec 2001, August Zajonc wrote: > > This is not really surprising, and the test is not really fair, the > > PHP code is not written by an experienced php programmer, and thus, > > would naturally be slower, on person benchmarks like this are simply > > too dependent on the person writing the code. > > -Sterling > > Give me a break. > > Did you even check a SINGLE one of the routines? Since you ARE an > experienced php programmer I'm attaching the nested loop test where PHP > scored at the BOTTOM of all 30 languages for you to optimize. I mean, I > looked over a number of the snippets and they are very straightforward, > especially the "same way" tests. > > This type of knee-jerk (and spectacularly uninformed) discounting of results > gets us nowhere and as you can probably tell irritates me no end :). There > are too many folks too quick to sound authoratative on an issue. Read > through the site, Doug is aware of the problems in benchmarking (everyone > who has ever tried doing them is probably aware) and worked hard to overcome > many of them. > > Anyways, the challenge is down, here's the code, optimize away. Then we can > talk about the real causes for PHP slow performance :) They still may be as > trivial as bad compile time or config settings but I think this bad php > programmer thing is a red herring. > > - August > > <?php/* > $Id: nestedloop.php,v 1.1 2001/05/06 06:13:21 doug Exp $ > http://www.bagley.org/~doug/shootout/ > */ > $n = ($argc == 2) ? $argv[1] : 1; > $x = 0; > for ($a=0; $a<$n; $a++) > for ($b=0; $b<$n; $b++) > for ($c=0; $c<$n; $c++) > for ($d=0; $d<$n; $d++) > for ($e=0; $e<$n; $e++) > for ($f=0; $f<$n; $f++) > $x++; > print "$x\n"; > ?> > Perl took 18 CPU secs, PHP 85. > > > > -- Zeev Suraski <[EMAIL PROTECTED]> http://www.zend.com/ -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]