[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Speed, or lack thereof



I'm running bigperl 510b2r2 on a PPC 9500 under Toolserver.  The 
following script, when executed on a Pentium 166 running Linux with 300K 
input file, takes 3 sec.  On the PPC with MacPerl, it takes 53 sec.  Why? 
 What can I do to speed this up?

(script is run like this: bigperl script.pl < infile > outfile )

#!/usr/local/bin/perl

while (<>) {
  if (/^(resource|data)\s*\'(([^\']|\\\'){4})\'\s*\((-?\d+)/i) {
    my($rtype, $number) = ($2, $4);

    push (@hunks, $hunk) if $hunk;
    $hunk = [$rtype, $number];
  }
  push(@$hunk, $_);
}
push (@hunks, $hunk) if $hunk;

map {
  map {
    print;
  } @$_[2..$#$_];
} sort {
  (uc($a->[0]) cmp uc($b->[0])) || ($a->[1] <=> $b->[1]);
} @hunks;

thanks,
-steve