Thread durch eigene error_log läuft script (18 answers)
Opened by bieber at 2007-08-02 10:43

bloonix
 2007-08-02 12:01
#97230 #97230
User since
2005-12-17
1615 Artikel
HausmeisterIn
[Homepage]
user image
Geschwindigkeit ist ein weiterer Grund ;)

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use strict;
use warnings;
use Benchmark;

my @datei = (1,'',2,';',3,'#');

sub long {
  foreach(@datei){
    next if /^$/;
    my $check="false";
    chomp; my @work = split /\s+/;
    $work[0]=~ s/^\s+//g;
    next if substr ($work[0],0,1) eq '#';
    next if substr ($work[0],0,1) eq ';';
    next if substr ($work[0],0,1) eq ''; 
  }
}

sub short {
  foreach (@datei) {
    my $check = "false";
    next if /^\s*(?:[#;]|$)/;
    chomp; my @work = split /\s+/;
  }
}

Benchmark::cmpthese(-1, {
   long  => \&long,
   short => \&short,
})

Code: (dl )
1
2
3
4
#> ./test.pl
Rate long short
long 55855/s -- -45%
short 101195/s 81% --
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 durch eigene error_log läuft script