Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re^2: Failed array attempby sauoq (Abbot) |
on May 14, 2012 at 00:21 UTC ( [id://970363]=note: print w/replies, xml ) | Need Help?? |
this difference in behavior will result in a significant performance win for any. It'll only save a constant factor and so it'll still be O(XY) whereas using a temporary hash would be O(X). The cost of using a hash would be additional storage on the order of O(Y) but, as you are already storing the array, this increase is just a constant factor. Comparatively, stopping at the first found element is better the more duplication there is in the array. But the more duplication in the array, the less the storage cost of using a temporary hash instead (for the theoretically significant improvement.) If you want efficiency, and aren't so short on storage that you can't do it, using a temporary hash is almost certainly the way to go.
-sauoq "My two cents aren't worth a dime.";
In Section
Seekers of Perl Wisdom
|
|