ruby/benchmark/enum_lazy_uniq_100.rb

5 строки
124 B
Ruby

uniq_data = (1..10_000).to_a
N = 100
enum = uniq_data.lazy.uniq {|i| i % 10000}.uniq {|i| i % 10000}
N.times {enum.each {}}