mirror of
https://github.com/jekyll/jekyll.git
synced 2026-01-30 01:08:26 -05:00
Calculating -------------------------------------
yield 70018 i/100ms
block.call 42809 i/100ms
-------------------------------------------------
yield 1099624.2 (±7.3%) i/s - 5531422 in 5.056107s
block.call 604006.1 (±7.1%) i/s - 3039439 in 5.058794s
15 lines
202 B
Plaintext
15 lines
202 B
Plaintext
require 'benchmark/ips'
|
|
|
|
def fast
|
|
yield
|
|
end
|
|
|
|
def slow(&block)
|
|
block.call
|
|
end
|
|
|
|
Benchmark.ips do |x|
|
|
x.report('yield') { fast { (0..9).to_a } }
|
|
x.report('block.call') { slow { (0..9).to_a } }
|
|
end
|