Sha256: 0ed2b9484009c733833d758165a07d6f1ffa8927ceda962898c54a05314c87ee

Contents?: true

Size: 381 Bytes

Versions: 1

Compression:

Stored size: 381 Bytes

Contents

require 'benchmark/ips'
require 'ruby-overload'

class Foo
  include Ruby::Overload

  def call(number)
    "foo #{number}"
  end

  def call
    'foo 42'
  end
end

class Bar
  def call(number)
    "bar #{number}"
  end
end

foo = Foo.new
bar = Bar.new

Benchmark.ips do |x|
  x.report('method overloading') { foo.call(23) }
  x.report('method') { bar.call(23) }
  x.compare!
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-overload-0.1.0 benchmarks/overload.rb