Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Failed array attemp

by sauoq (Abbot)
on May 14, 2012 at 00:21 UTC ( [id://970363]=note: print w/replies, xml ) Need Help??


in reply to Re: Failed array attemp
in thread Failed array attemp

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.";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://970363]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-24 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found