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

[MacPerl] Associative array hogging less memory




It turns out that one problem in my Extremely Rapid (i.e. sloppy)
Application Development was creating 4 associative arrays, not one.  Now
the script is much faster, and uses less memory (runs under 3 MB).
Obviously, however, I am still interested in reducing the memory usage for
associative arrays.

New code:

sub loadxref {
  while (<CHTPYPY>) {
    chop;
    if (! /^$/ && /^[^\#]/) {  #if line is non-empty and not comments
      ($ch, $tpy, $py, $fourc, $cangjie) = split;
      $tppyfccj = join("\t",$tpy, $py, $fourc, $cangjie);
      $ch2tppyfccj{$ch} = $tppyfccj;         #assigns $tppyfccj to key $ch.
    }
  }
  print "\nFinished loading the cross-reference table!!\n";
  close(CHTPYPY);
}



Thanks for your suggestions,

Roger Hart