https://github.com/jekyll/jekyll
Raw File
Tip revision: b0c591a3f2c8f47bdfc8a54774f1bb8e76f6f2a7 authored by Pat Hawks on 28 October 2016, 01:30:32 UTC
Add Inline Markdown converter
Tip revision: b0c591a
string-replacement
require 'benchmark/ips'

def str
  'http://baruco.org/2014/some-talk-with-some-amount-of-value'
end

Benchmark.ips do |x|
  x.report('#tr')    { str.tr('some', 'a')    }
  x.report('#gsub')  { str.gsub('some', 'a')  }
  x.report('#gsub!') { str.gsub!('some', 'a') }
  x.report('#sub')   { str.sub('some', 'a')   }
  x.report('#sub!')  { str.sub!('some', 'a')  }
end
back to top