Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
The stupid question is the question not asked
 
PerlMonks  

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

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.