Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Date: Sun, 29 Dec 2013 17:29:27 +0100 From: Luuk User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 Newsgroups: comp.programming Subject: Re: Perl or PHP? References: <98a3pa-0sq.ln1@luuk.invalid.lan> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <78v5pa-34i.ln1@luuk.invalid.lan> Lines: 56 NNTP-Posting-Host: 2001:980:9089:1:fca7:d565:ab76:dd63 X-Trace: 1388334601 news.xs4all.nl 2862 [2001:980:9089:1:fca7:d565:ab76:dd63]:59822 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.programming:4063 On 28-12-2013 23:13, BartC wrote: > "Luuk" wrote in message > news:98a3pa-0sq.ln1@luuk.invalid.lan... >> On 28-12-2013 17:11, Victor Porton wrote: > >>> Could you disclose the content of files test.pl and test.php? >>> >>>> But the question of course is, what are your comparing? >>>> >>>> ;-) >>> >> >> 1 #!/usr/bin/perl >> 2 >> 3 for ($count = 1000; $count >= 1; $count--) { >> 4 print "$count "; >> 5 } >> >> >> and >> >> 1 #!/usr/bin/php >> 2 >> 3 > 4 for ($f=1000; $f>=1; $f--) >> 5 echo "$f "; > > So you're mainly testing I/O rather than the language: which depends on the > commands that are used for output in the language, how they are > implemented, > how the console is driven, the console implementation code, the kind of > display, etc. > > Changing your tests a little so that the loops increment a variable, and > putting the output at the end, makes PHP twice as fast as Perl (on the same > setup which had PHP seven times slower than Perl using your tests.) Eg: > > $a=0; > for ($count = 10000000; $count >= 1; $count--) { > $a=$a+1; > etc. > > Still a lousy benchmark, but at least it avoids I/O which is highly > misleading. > > thats why i said: what are your comparing? ;-) The starting point of this thread was wrong. OP should have investigated the strong, an weak points of both choices, in stead of yust focussing on 'performance'