require '../lib/cartesian' require 'benchmark' MULTIPLIER = 3 letras = ("a"*MULTIPLIER.."z"*MULTIPLIER).to_a numeros = (0..10**1).to_a Benchmark.bmbm do |x| x.report("product") { Cartesian.product(letras, numeros) } x.report("productZip") { Cartesian.productZip(letras, numeros) } end #~ def Cartesian.productZip(first, second) #~ result = [] #~ first.each do |a| #~ aaa = Array.new(second.size) { a } #~ result += aaa.zip(second) #~ end #~ result #~ end