Sha256: 5ef6ffc17ae1e40309b3e2e2f78e216abd495fd004c347c353da3714dd471dc1

Contents?: true

Size: 394 Bytes

Versions: 4

Compression:

Stored size: 394 Bytes

Contents

#!/usr/bin/env ruby

root_dir = File.expand_path(File.join(File.dirname(__FILE__),'..'))
lib_dir = File.join(root_dir,'lib')
$LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)

require 'benchmark'
require 'combinatorics/choose'

Benchmark.bm do |b|
  n     = 20
  array = (1..n).to_a

  (1..n).each do |i|
    b.report("n=#{n} k=#{i}") do
      array.choose(i) { |s| }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
combinatorics-0.5.0 benchmarks/choose.rb
combinatorics-0.4.4 benchmarks/choose.rb
combinatorics-0.4.3 benchmarks/choose.rb
combinatorics-0.4.1 benchmarks/choose.rb