Thread permutation (31 answers)
Opened by esskar at 2006-09-11 12:30

renee
 2006-09-13 20:02
#69646 #69646
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
[quote=Thorium,13.09.2006, 15:09]Hier, ich hab auch noch einen Vorschlag; auch wenn ich im Benchmark damit Canchenlos bin ;):

Code (perl): (dl )
1
2
3
4
5
6
sub fbhp {
    [...]
    my @status;
    my $count = $#elements;
    push @status, 0 for (0..$count); 
   [...]



[...][/quote]
Etwas Zeit kannst Du sparen, indem Du aus
Code: (dl )
1
2
3
    my @status;
my $count = $#elements;
push @status, 0 for (0..$count);


Code: (dl )
my @status = (0) x scalar(@elements)
machst:

Code: (dl )
1
2
3
4
5
C:\community>perl bench.pl

Rate thorium renee
thorium 1131/s -- -57%
renee 2656/s 135% --


bench.pl
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/perl

use Benchmark qw(:all);
use strict;
use warnings;

my @elements = (1) x 1000;

cmpthese( 10000, {
'renee' => sub {my @status = (0) x scalar(@elements)},
'thorium' => sub {my @status;
my $count = $#elements;
push @status, 0 for (0..$count); }
});
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread permutation