in reply to Re: fast bit twiddling
in thread fast bit twiddling
There's a mistake here, since the eq operator has an higher precedence than the comma.
The sub should be written this way:
See here for the updated benchamark results.
Cheers, Emanuele.
The sub should be written this way:
Oddly enough, after the correction above this solution proves to be the fastest (probably because it reaches the first return more frequently.)sub buk2{ my $s = shift; substr($s, $_-1, 1) eq substr($s, $_, 1) and return for @_; return 1; }
See here for the updated benchamark results.
Cheers, Emanuele.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: fast bit twiddling
by BrowserUk (Patriarch) on May 04, 2004 at 22:08 UTC | |
by emazep (Priest) on May 05, 2004 at 11:02 UTC |
In Section
Seekers of Perl Wisdom