Sha256: 9f8ceada3057ecd7428d6f09131f12c25549d04d2a70defdf14f33bda5435ce3

Contents?: true

Size: 520 Bytes

Versions: 2

Compression:

Stored size: 520 Bytes

Contents

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

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
Cartesian-0.1.0 tests/benchmark.rb
Cartesian-0.1.0 tests/tc_cartesian.rb