https://github.com/jekyll/jekyll
Raw File
Tip revision: 68089c401a7c09a82b0af4121a2de28536f1b216 authored by Matt Rogers on 15 January 2024, 01:21:09 UTC
fix: undo the capture for the content menu
Tip revision: 68089c4
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