Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Evolving a faster filter?

by RichardK (Priest)
on Jan 04, 2013 at 15:30 UTC ( #1011655=note: print w/ replies, xml ) Need Help??


in reply to Evolving a faster filter?

It seems like you are traversing the list of thousands of objects many times, and maybe even copying lots of objects too!

So would it be faster to only traverse the objects once? So something like this

NEXT_OBJ: foreach my $obj (@objects) { foreach my $filter (@filters) { next NEXT_OBJ unless $filter->($obj); } push @results,$obj; }

I think there's a smart way to do that with iterators/closures too, but I don't know how fast it would be.


Comment on Re: Evolving a faster filter?
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011655]
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: (10)
As of 2014-07-10 07:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (202 votes), past polls