Re: Speed comparison of PHP vs. PERL (not conclusive)
| From: | Jerry | Date: | Mon, 03 Jun 2002 17:00:11 +0000 |
| Subject: | Re: Speed comparison of PHP vs. PERL (not conclusive) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-100432@lists.php.net to get a copy of this message | ||
In article <20020531213619.27198.qmail@pb1.pair.com>,
rubein@earthlink.net (Daniel Grace) wrote:
> Comments? I was expecting the numbers to be very similiar -- rather shocked
> that the PERL ended up being about 2.5x as fast as PHP was.
As Rasmus says, one of the things Perl was designed for was speed. The
Perl designers really take speed seriously for things like this, because
Perl tends to be used for things like looping over a few million lines
of text. I resisted Perl for a long time because of its somewhat odd
syntax, but the first time I programmed in it seriously, the main thing
that wasted my time was that I didn't believe my program was working; I
was re-writing a log analysis program; the previous version, in a
different language (which did other things very well but wasn't designed
for looping at all) took about 6 hours to complete an analysis. It was
getting to where I could foresee that the daily log analysis was going
to take longer than a day!
I couldn't get the Perl program to do anything. It seemed to work on the
short test data, but on the full file I'd type the command and it would
just drop right back to the command line. Of course the program was
working fine--Perl was doing its work almost instantaneously.
Each language has its advantages; I tend to use PHP for web pages, but
there are times I'd like to easily switch back and forth between PHP and
Perl on the same page. Perl makes great filters.
Jerry
--
http://www.hoboes.com/jerry/
"Give a man a fish and you feed him for a day. Teach him to fish, and you've
depleted the lake."--It Isn't Murder If They're Yankees
(http://www.hoboes.com/jerry/Murder/)