Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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.


In reply to Re: Evolving a faster filter? by RichardK
in thread Evolving a faster filter? by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    [Discipulus]: who make the invitation? the program?!?
    [choroba]: it's historical
    [erix]: pull requests
    [choroba]: originally, you sent a pull request to someone by email, i.e. you asked them to pull from your repo
    [Discipulus]: if is the author of a patch, is more like a 'request to push' into rather than a pull request..
    [choroba]: as it's considered unpolite to push to someone else's repo
    [choroba]: and in fact, you don't push into the target repo, you push into your branch of your fork
    [choroba]: the maintainer of the upstream repo than "merges" the pull request, i.e. they pull from your fork into the upstream
    [Discipulus]: ' i.e. you asked them to pull from your repo' =~ I (subj) want to push
    [Discipulus]: chorobayour words are reasonable

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (7)
    As of 2017-05-27 20:10 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?