Front page | perl.fwp |
Postings from November 2001
Feel good benchmarks
Thread Next
From:
Michael G Schwern
Date:
November 20, 2001 02:39
Subject:
Feel good benchmarks
Message ID:
20011120053647.Q11883@blackrider
Some of you may get depressed thinking about all this bloat we've put
into the language to drag it down.
Well, I've developed a truely rigorous benchmark designed to show how
far Perl has come:
sub f {
my($num) = shift;
return $num if $num <= 1;
return f($num-1) + f($num-2);
}
print f(25);
bleadperl
real 0m2.282s
user 0m2.210s
sys 0m0.010s
Debian's 5.6.1
real 0m2.643s
user 0m2.510s
sys 0m0.020s
My own compiled 5.6.1
real 0m2.141s
user 0m2.080s
sys 0m0.020s
5.005_03
real 0m2.180s
user 0m2.140s
sys 0m0.010s
5.004_05
real 0m2.342s
user 0m2.140s
sys 0m0.160s
5.004_04
real 0m5.515s
user 0m5.380s
sys 0m0.110s
5.004
real 0m5.542s
user 0m5.340s
sys 0m0.150s
5.003_07
real 0m5.581s
user 0m5.340s
sys 0m0.200s
So we're doing something right. And this lame benchmark might
actually be useful in convincing some luddite 5.004_04 user to upgrade
Perl.
And for comparative purposes
def f(num)
return num if num <= 1
return f(num-1) + f(num-2)
end
print f(25)
Ruby 1.6.5
real 0m2.225s
user 0m2.190s
sys 0m0.000s
Oh dear. And it took one less line, too.
And just to end this feel good email on a real downer:
#include <stdio.h>
int f (int num) {
if( num <= 1 )
return num;
return f(num-1) + f(num-2);
}
int main (void) {
printf("%d", f(25));
}
gcc 2.95.4
real 0m0.077s
user 0m0.030s
sys 0m0.000s
--
Michael G. Schwern <schwern@pobox.com> http://www.pobox.com/~schwern/
Perl Quality Assurance <perl-qa@perl.org> Kwalitee Is Job One
OH GOD!! It's LINUX! All you Linux fanboys go wild! It never crashes!
It'll wash your underpants! It'll eat your dog for you, if you want your
dog to be eaten! It'll make you attractive and smell good and... it'll...
uh... uh. Man, I'm so sick of this shit.
http://www.goats.com/archive/000602.html
Thread Next
-
Feel good benchmarks
by Michael G Schwern