I am sorry to be such an @[EMAIL PROTECTED]@ but have you actually measured that
you have a problem with speed at the point of deleting the elements?
How big is that array anyway?

Maybe the whole operation takes 0.01% of the total run time?

On the other hand if the array is really so big, maybe you reached the limit
of your memory when you have it twice in there (when using grep)?
Then maybe you don't have to hold all this information in memory all the time?

Now that you have the suggestions from others I would be really glad to see
some benchmarks you publish on the relative speed of
grep vs loop and splice.

Gabor

On 5/24/07, Yossi Itzkovich <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Assuming I have a big array, and I want to remove elemnts according to a
> criteria, how do I do it ?
> Please note, I am not asking about getting a new list of elements that
> passed the filter (like grep does), but removing the items from the
> original list.  For a big array (and assuming that arrays are
> implemented with linked list (is it ?)), then removing items from the
> original list might be much faster.
>
>
> Yossi

-- 
Gabor Szabo
http://www.szabgab.com/
Perl Training in Israel  http://www.pti.co.il/
_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl

Reply via email to