Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 examining the Monastery: (7)
As of 2014-12-22 10:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (114 votes), past polls