in reply to How to improve this data structure?

A simple fix which might help a bit is to grep the array before running sort on it:
for (sort { $a->{RegionNum} <=> $b->{RegionNum} or $a->{AR} <=> $b->{AR} } grep $_->{RegionNum} == $RegionNum, @StatsArray) { $ARKey = $_->{AR}; # do stuff, no need to check the RegionKey. }

Untested.

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: How to improve this data structure?
by fiddler42 (Beadle) on May 21, 2013 at 17:55 UTC
    Thanks a lot...this simple grep reduced runtimes by about 35%.