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

Re^5: Fast data structure..!!!

by moritz (Cardinal)
on Apr 15, 2008 at 16:59 UTC ( #680577=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Fast data structure..!!!
in thread Fast data structure..!!!

I still don't get why it takes 15s for you to execute that code, it runs in 3s on mine. Did your machine swap to disk or something? Or is that an ancient machine? or a debugging perl?

A few thoughts anyway:

1. Try to pack vector. You're only accessing it linearly anway

2. Try not to use that vector at all. You can populate your %pos hash in the first place instead

3. Store the data structure on disk once, for example in a BerkeleyDB. It seems to be constant, so you don't actually need to calculate it every time your program starts. Or store $wektor in a plain binary file after you created it, and in subsequent runs only retrieve that from disk and generate your hash from it.


Comment on Re^5: Fast data structure..!!!
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2014-08-02 07:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (55 votes), past polls