----- Original Message -----
From: "Rowel Atienza" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 08, 2002 8:13 AM
Subject: Re: [OT] Perl benchmarking (Re: [plug] Re: [OT] bitwise operations
with perl)


>
>
> On Thu, 7 Feb 2002, Sherwin Daganato wrote:
>
> > I don't know. I can't explain it.
> > I just couldn't believe the way you benchmark Perl codes.
> > If that's the right way then why would anyone create the
> > Benchmark module (see CPAN :-).
> >
>
> My mistake. I think which one is faster is system dependent. I run two
> tests using my benchmarking code (bm.c):

well i tested it to two hardwares, intel 386 and sun ultra-sparc, bitwise
operator still wins.

for intel 386 using P500mhz, i have quadruple operating system installed (ms
windows, redhat linux, freebsd and solaris) and tested it on linux, freebsd
and solaris using these two codes:

$ more exp.pl
#!/usr/bin/perl
$masklen = 24;
for ($i = 3000000; $i; $i--) {
        $mask = (2 ** ($masklen + 1)) - 1;
}

$ more bit.pl
#!/usr/bin/perl
$masklen = 24;
for ($i = 3000000; $i; $i--) {
        $mask = (1 << ($masklen + 1)) - 1;
}

Red Hat Linux release 7.2 (Enigma)
Kernel 2.4.7-10 on an i686

[fooler@noc01 temp]$ perl -v

This is perl, v5.6.0 built for i386-linux

[fooler@noc01 temp]$ time ./exp.pl

real    0m6.522s
user    0m6.520s
sys     0m0.000s

[fooler@noc01 temp]$ time ./bit.pl

real    0m6.347s
user    0m6.340s
sys     0m0.000s

FreeBSD 4.5-RELEASE (FOOLER) #0: Thu Jan 31 20:34:58 PHT 2002

[fooler@noc01 temp]$perl -v

This is perl, version 5.005_03 built for i386-freebsd

[fooler@noc01 temp]$time ./exp.pl

real    0m9.603s
user    0m9.461s
sys     0m0.008s

[fooler@noc01 temp]$time ./bit.pl

real    0m7.463s
user    0m7.361s
sys     0m0.000s

Sun Microsystems Inc.   SunOS 5.8       Generic February 2000

$ perl -v

This is perl, version 5.005_03 built for i86pc-solaris

$ time ./exp.pl

real        7.8
user        7.8
sys         0.0

$ time ./bit.pl

real        7.3
user        7.3
sys         0.0

and for sun's old ultrasparc hardware

SunOS 5.5 Generic_103093-26 sun4u sparc SUNW,Ultra-1

$ perl -v

This is perl, version 5.004_03

$ time ./exp.pl

real       35.3
user       35.3
sys         0.0

$ time ./bit.pl

real       24.2
user       24.1
sys         0.0


fooler.

_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

To subscribe to the Linux Newbies' List: send "subscribe" in the body to 
[EMAIL PROTECTED]

Reply via email to