Thread Hash als Option missbrauchen (118 answers)
Opened by bloonix at 2005-12-19 02:24

bloonix
 2005-12-19 19:27
#60989 #60989
User since
2005-12-17
1615 Artikel
HausmeisterIn
[Homepage]
user image
[quote=esskar,19.12.2005, 18:09]@pq: poste mal deine benchmarks :p[/quote]
Code: (dl )
1
2
3
4
5
6
7
8
9
10
my @array = (1,2,3,4,5);

Benchmark::cmpthese(-1, {
        '& 1'        =>  sub { my $val = 1 if @array & 1; },
        'modulo 2'   =>  sub { my $val = 1 if @array % 2; },
});

             Rate modulo 2      & 1
modulo 2 3113701/s       --      -9%
& 1      3429921/s      10%       --


war zwar nur ein Scherz und auch nicht an mich gerichtet, ich war aber
trotzdem so frei ...
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.

View full thread Hash als Option missbrauchen