Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Memory issue with large array comparison

by pemungkah (Priest)
on May 24, 2012 at 21:17 UTC ( #972324=note: print w/replies, xml ) Need Help??


in reply to Memory issue with large array comparison

When you say "doesn't match any of" I think of a hash rather than arrays; otherwise you're spending lots of runtime searching, when a hash would just hand it to you, O(1).

How about building a hash out of the pathnames, with the keys being the last part of the name, and the value being the path? That way, to get the ones that aren't in the safelist, you'd just look over the safelist and delete those keys. Anything left is not safe.

Would that work? It would certainly be faster.

  • Comment on Re: Memory issue with large array comparison

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://972324]
help
Chatterbox?
and the pool shimmers...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2016-12-04 17:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (69 votes). Check out past polls.