Sha256: 6692022d4a750208b39a76eb60dde3a411b7afb008e39770a74329696924843b
Contents?: true
Size: 822 Bytes
Versions: 6
Compression:
Stored size: 822 Bytes
Contents
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib') require 'benchmark/ips' require 'memoist' class Benchy extend Memoist def arity_0 'Hello World' end memoize :arity_0 def arity_1(name) "Hello #{name}" end memoize :arity_1 end OBJECT = Benchy.new puts "Benchmarking: #{Memoist::VERSION}" Benchmark.ips do |x| x.report('arity 0 - memoized') do |times| times.times do OBJECT.arity_0 end end # x.report("arity 0 - unmemoized") do |times| # times.times do # OBJECT._unmemoized_arity_0 # end # end x.report('arity 1 - memoized') do |times| times.times do OBJECT.arity_1(:World) end end # x.report("arity 1 - unmemoized") do |times| # times.times do # OBJECT._unmemoized_arity_1(:World) # end # end end
Version data entries
6 entries across 6 versions & 4 rubygems