Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Fast seeking in a large array of hashes to generate a report.

by barrachois (Pilgrim)
on Jun 23, 2005 at 07:37 UTC ( [id://469310]=note: print w/replies, xml ) Need Help??


in reply to Fast seeking in a large array of hashes to generate a report.

First, you might consider using a relational database (SQLite, MySQL, ...) - that's what they're for, eh?

Second, if you really want to code it yourself, and depending on how large the menu of possible selections is, you could generate lookup hashes ahead of time. If, for example, you have 200 possible surnames and 50 possible ages, then you could generate a hash with keys 'surname-age' (e.g. 'smith-25') whose values are something like a reference to a list of indices into @Persons (e.g. [ 10, 102, 145, ... ] ). Seems like a classic "space-vs-speed" trade off.

An intermediate approach might be to somehow cache the results of each filter loop, so that the slow part only happens once.

  • Comment on Re: Fast seeking in a large array of hashes to generate a report.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-25 12:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found