Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Evolving a faster filter?

by RichardK (Parson)
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.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2016-10-27 20:16 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (371 votes). Check out past polls.