[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] sifting



On Apr 12, Jeff Pinyan said:

>  sub grep_sift {
>    my @sifted = ();
>    my @list = @{ shift() };
>
>    for my $re (@_) {
>      my @normal;
>      push @sifted, grep {
>        ($_ =~ $re) ? 1 : do { push(@normal, $_), 0 }
>      } @list;
>      @list = @normal;
>    }
>
>    return (@sifted,@list);
>  }

I sped up grep-sift, and now it seems to run consistently faster.  I'll
keep testing though.

  http://www.pobox.com/~japhy/DALnet-perl/sift/

-- 
MIDN 4/C PINYAN, NROTCURPI, US Naval Reserve             japhy@pobox.com
http://www.pobox.com/~japhy/                  http://pinyaj.stu.rpi.edu/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe