Sha256: 9c77a9da7f778fff2d43f5cd62f1d65748c030334370c90eff08336c64ac39f5
Contents?: true
Size: 375 Bytes
Versions: 77
Compression:
Stored size: 375 Bytes
Contents
# frozen_string_literal: true require 'benchmark' LIMIT = 1_000_0 def do_while i = 0 while true i += 1 break if i == LIMIT end end def do_loop i = 0 loop do i += 1 break if i == LIMIT end end GC.disable Benchmark.bm do |x| x.report('while') do LIMIT.times { do_while } end x.report('loop') do LIMIT.times { do_loop } end end
Version data entries
77 entries across 77 versions & 1 rubygems