Sha256: d6031f09739844896acdd5e43aa10821fdca5bd75a4833f74d9708cc12c87d57

Contents?: true

Size: 423 Bytes

Versions: 3

Compression:

Stored size: 423 Bytes

Contents

require "standard_deviation"
require "bigdecimal"
require "benchmark"

n = 100
range =  (1..10_000)

integers = range.to_a
floats   = range.map(&:to_f)
decimals = range.map { |value| BigDecimal.new [value, (rand * 10000000000).to_i].join(".") }

Benchmark.bm do |b|
  b.report do
    n.times { integers.stdev }
  end

  b.report do
    n.times { floats.stdev }
  end

  b.report do
    n.times { decimals.stdev }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
standard_deviation-1.0.3 benchmark/types.rb
standard_deviation-1.0.2 benchmark/types.rb
standard_deviation-1.0.1 benchmark/types.rb