Sha256: 1ee758c2cc67cd0ceda51679ae1bc0a43b4dcbb1bea30e730ad8baa64f45320f
Contents?: true
Size: 812 Bytes
Versions: 1
Compression:
Stored size: 812 Bytes
Contents
$:.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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
memoist-0.15.0 | script/benchmark.rb |