diff --git a/benchmark/core/array/bench_combination.rb b/benchmark/core/array/bench_combination.rb new file mode 100644 index 0000000000..42d1a3fa98 --- /dev/null +++ b/benchmark/core/array/bench_combination.rb @@ -0,0 +1,24 @@ +require 'benchmark' +require 'benchmark/ips' +require File.expand_path('../shared_array.rb', __FILE__) + +Benchmark.ips do |x| + small_array = $small_array.dup + + x.report "combination by groups of 2" do |times| + i = 0 + while i < times + small_array.combination(2).to_a + i += 1 + end + end + + x.report "combination by groups of 4" do |times| + i = 0 + while i < times + small_array.combination(4).to_a + i += 1 + end + end + +end