----- Original Message ----- 
From: "Sherwin Daganato" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 07, 2002 9:02 PM
Subject: Re: [plug] Re: [OT] bitwise operations with perl


> 'exponentiation' won. It's 52% faster than 'bit_shift' @ 500000
> iterations.

i dont think so :->

[fooler@ns1 temp]$vi x.pl
#!/usr/bin/perl

$masklen = 24;

for ( $i = 1000000; $i; $i--) {
        $mask = (2 ** ($masklen + 1)) - 1;
}


[fooler@ns1 temp]$time ./x.pl

real    0m9.847s
user    0m9.798s
sys     0m0.018s
[fooler@ns1 temp]$time ./x.pl

real    0m9.831s
user    0m9.821s
sys     0m0.002s

[fooler@ns1 temp]$vi x.pl
#!/usr/bin/perl

$masklen = 24;

for ( $i = 1000000; $i; $i--) {
        $mask = (1 << ($masklen + 1)) - 1;
}


[fooler@ns1 temp]$time ./x.pl

real    0m7.372s
user    0m7.340s
sys     0m0.010s
[fooler@ns1 temp]$time ./x.pl

real    0m7.351s
user    0m7.346s
sys     0m0.002s

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