Suggested by Rory O'Kane in GH issue #167.
The #filter method was renamed to #select in 3917c76, to match the Ruby standard library.
…ore carefully It turns out the point where the optimization becomes useful is higher than I previously thought.
…superset? when Array is passed This gives a *big* boost in performance.
Introduce a subclass of AVLNode which doesn't use a comparator function.
…ge or length
… item If a SortedSet has a custom order, it should be maintained *even when* the set is emptied -- because subsequently, more items might be added again.
List#indices already does everything which #find_indices and #elem_indices can do. This implementation of #indices is a bit clumsy, especially the way it passes arguments on recursive calls. Maybe it can be improved later. All the specs for #find_indices and #elem_indices have been combined in a single spec file for #indices.
Rather than traversing the tree twice, once to check if an item is there, and again to insert it, we just traverse down once, and use 'throw' to bail if we discover the item is already there. This gives about 8% speed boost to #insert.
If passed a large Array, convert it to a Set to avoid O(n^2) runtime. The extra checks incur a 4-5% penalty when doing many #subset? checks on small collections, but the method is enormously faster when passed larger Arrays.