Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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 ( #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
Node Status?
node history
Node Type: note [id://469310]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2014-09-23 20:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (241 votes), past polls