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