John W. Krahn am Samstag, 7. April 2007 01:05:
> D. Bolliger wrote:
> > Chas Owens am Freitag, 6. April 2007 13:27:
[snip
> $ perl -e'
> use Benchmark q[cmpthese];
> my $wordlist = qx[cat /usr/share/dict/words];
> cmpthese -10, {
>     twomaps => q{ join " ", map ucfirst, map lc, split " ", $wordlist },
>     onemap  => q{ join " ", map ucfirst( lc ), split " ", $wordlist },
>     subst   => q{ ( my $x = $wordlist ) =~ s/(\S+)/\L\u$1/g; $x },
>     };
> '
>              Rate twomaps  onemap   subst
> twomaps 1729492/s      --    -13%    -38%
> onemap  1981233/s     15%      --    -30%
> subst   2811473/s     63%     42%      --

Hmm... quite impressive... I didn't expect substitution to be so performant.
Seems that expectations are not the best replacement for benchmarking :-)

btw, nice test! Thanks, John

Dani

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to