https://github.com/jekyll/jekyll
Raw File
Tip revision: 1898ced3c465321c3bc7d2dfb9f5a7b976e59bef authored by Alexey Pelykh on 25 September 2017, 14:59:39 UTC
Added docs for enhanced link tag
Tip revision: 1898ced
proc-call-vs-yield
#!/usr/bin/env ruby
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
back to top