Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Why is my program so slow even though I've used hashes?

by moritz (Cardinal)
on May 28, 2009 at 16:30 UTC ( [id://766693]=note: print w/replies, xml ) Need Help??


in reply to Why is my program so slow even though I've used hashes?

Well, programs don't run faster magically just because you use hashes. They only give you speed if you don't have to loop over the whole hash, but look up the values by key.

So instead of using your current keys for storage, use the value that is called $pdbchain in your program as a hash key. Then you can replace whole while (($key, $value) = each %hash) { if ($a eq $b) { ... } } with a single hash lookup, which should improve the performance.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-25 15:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found