Help for this page

Select Code to Download


  1. or download this
    my $limit = 100;
    my $file  = 'big.file';
    
    ...
        return @{$current == \@alpha ? \@beta : \@alpha}[-($limit - scalar
    + @$current)..-1],
            @$current;
    }
    
  2. or download this
    % perl tailbm -30 10 100.lines 
    
    ...
       grinder:  74 wallclock secs (28.38 usr +  2.77 sys = 31.15 CPU) @ 5
    +66.52/s (n=17647)
         lastn:  69 wallclock secs (19.78 usr + 11.34 sys = 31.12 CPU) @ 2
    +2.88/s (n=712)
    lastn_getc:  77 wallclock secs (18.88 usr + 13.17 sys = 32.05 CPU) @ 1
    +9.78/s (n=634)
    
  3. or download this
    % perl tailbm -30 100 721994.lines 
    Benchmark: running f_rb_obj, f_rb_obj_u, f_rb_tie, f_rb_tie_u, file_ta
    +il, grinder, each for at least 30 CPU seconds...
    ...
                (warning: too few iterations for a reliable count)
         lastn:  40 wallclock secs (20.15 usr + 10.80 sys = 30.95 CPU) @ 1
    +9.48/s (n=603)
    lastn_getc:  42 wallclock secs (18.05 usr + 13.81 sys = 31.86 CPU) @ 1
    +7.70/s (n=564)
    
  4. or download this
    #! /usr/bin/perl -w
    
    ...
        'lastn_getc' => \&lastn_getc, 
    });
    __END__