https://github.com/jekyll/jekyll
Raw File
Tip revision: ed2d30dc882711086e8cf9452d5d8a574928a058 authored by Parker Moore on 03 August 2017, 00:18:11 UTC
URL#generate_url_from_drop: optimizations to reduce object creation & speed things up
Tip revision: ed2d30d
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