Sha256: 978283b5d902ae839376ecaa2fb4d54a86a907b278296afd14399a3123b99645
Contents?: true
Size: 565 Bytes
Versions: 1
Compression:
Stored size: 565 Bytes
Contents
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib')) require 'bench_press' require 'distribution' extend BenchPress name 'calculate factorial vs looking on a Hash' author 'Claudio Bustos' date '2011-01-31' summary " Is better create a lookup table for factorial or just calculate it? Distribution::MathExtension::SwingFactorial has a lookup table for factorials n<20 " reps 1000 # number of repetitions measure 'Lookup' do Math.factorial(19) end measure 'calculate' do Distribution::MathExtension::SwingFactorial.naive_factorial(19) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
distribution-0.8.0 | benchmark/factorial_hash.rb |