Sha256: a608cf0375ec65b94f801e849221bd24324fd42d13509529671c5dd1016cd7e6

Contents?: true

Size: 541 Bytes

Versions: 8

Compression:

Stored size: 541 Bytes

Contents

contexts:
  - name: "master"
    prelude: |-
      require 'bundler/setup'
      require 'enumerable/statistics'
prelude: |-
  n = 1000
  ary = Array.new(n) { rand }
benchmark:
  inject: mean = ary.inject(:+) / n.to_f
  while: |-
    i, mean = 0, 0
    while i < n
      mean += ary[i]
      i += 1
    end
    mean /= n.to_f
  pure_ruby: |-
    i, f, c = 0, 0.0, 0.0, 0.0, 0.0
    while i < n
      x = ary[i]
      y = x - c
      t = f + y
      c = (t - f) - y
      f = t

      i += 1
    end
    mean = f / n
  c_ext: mean = ary.mean

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
enumerable-statistics-2.0.7 bench/mean.yml
enumerable-statistics-2.0.6 bench/mean.yml
enumerable-statistics-2.0.5 bench/mean.yml
enumerable-statistics-2.0.3 bench/mean.yml
enumerable-statistics-2.0.2 bench/mean.yml
enumerable-statistics-2.0.1 bench/mean.yml
enumerable-statistics-2.0.0 bench/mean.yml
enumerable-statistics-2.0.0.pre bench/mean.yml