From: Joseph McDonald Date: 2002-07-07T00:02:58+09:00 Subject: Re: fast "set difference" on arrays >> when I want to take the "set difference", arr3 = arr1-arr2, meaning "take >> all elements from arr1 which dont appear in arr2" this takes forever - I >> don't even know how long because I stopped early ;) DT> The following runs in about .5s on my pokey old box: DT> s1 = {} DT> File.foreach(ARGV[1]) {|line| s1[line] = 1} DT> File.foreach(ARGV[0]) {|line| puts(line) unless s1[line]} DT> Note that it's doing String comparisons, not integer ones, but if both DT> of your files are generated the same way that won't be a problem. Do you think Array#- should do the hash trick internally instead of a complete scan x*y times ? I do. thanks, -joe