in reply to Failed array attemp
A number of replies use the grep built-in to scan an array for the presence of an element of another array. The problem with grep is that it will always scan the entire array even though the OPer only seems interested in the first occurrence of the element in the scanned array. List::MoreUtils::any will stop scanning at the first occurrence. For some value of the product of the sizes of the two arrays (100,000? 1,000,000? ...? Benchmark to find out), this difference in behavior will result in a significant performance win for any. For sufficiently small arrays, the difference is trivial.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Failed array attemp
by sauoq (Abbot) on May 14, 2012 at 00:21 UTC |