From: Yukihiro Matsumoto Date: 2008-06-24T00:32:29+09:00 Subject: [ruby-core:17382] Re: A faster Array#delete Hi, In message "Re: [ruby-core:17381] Re: A faster Array#delete" on Tue, 24 Jun 2008 00:15:47 +0900, "Berger, Daniel" writes: |>Besides that, it |> doesn't work well (out of bound access) if the comparing |> method alters (e.g. shorten) the receiver. | |Can you give us some examples? They would be useful test cases. Your version would have access violation with the following program. matz. --- require 'benchmark' class Foo def ==(other) $array.clear false end end MAX = 30000 array = ['daniel'] * 1000 array << ['charles'] * 1000 array << ['matz'] * 1000 array << 'larry' array << Foo.new array << ['larry'] * 1000 array << ['guido'] * 1000 array.flatten! $array = array Benchmark.bm(10) do |x| x.report("delete"){ MAX.times{ array.delete('larry') } } p array.size end