Sha256: 6eac76179db389d4dc4855dfca9bc5928ed07bca5fea4ef93e2884aa73c6b56b
Contents?: true
Size: 548 Bytes
Versions: 63
Compression:
Stored size: 548 Bytes
Contents
require 'benchmark' class TestSubject def tvalue catch :value do tget end end def rvalue catch :value do rget end end def tget throw :value, 'hello' end def rget return 'hello' end end TEST_AMOUNT = 1_000_000 Benchmark.bm(15) do |x| x.report('throw') do test_subject = TestSubject.new TEST_AMOUNT.times do test_subject.tvalue end end x.report('return') do test_subject = TestSubject.new TEST_AMOUNT.times do test_subject.rvalue end end end
Version data entries
63 entries across 63 versions & 2 rubygems