That's good. Unfortunately, anything involving recursion in perl tends to hit performance quite badly once the volumes of data rise.
If the mapping to integer coords is working okay, then you could (potentially) save a bit more time on large volumes of data by concatenating the pack'd integers rather than the ascii representations.
$hash{ join'', pack 'N3', $x, $y, $z } = 'name x.xx y.yy z.zz';
This would allow you to do an alpha sort rather than a numeric one, and avoids the need to add leading zeros to the values. It might also conserve a little space, though you are unlikely to see this unless your resultant concatenated ascii values are greater than 12 characters.
You'd need to benchmark some typical datasets to see what if any benefit this would have, and where an transitions occured.
Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
|