Sha256: b1c56a8be4a218ce9914a9348bd446e4b07a8eb9177d4d4363e3eb1a5ca9f195

Contents?: true

Size: 417 Bytes

Versions: 26

Compression:

Stored size: 417 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

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

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
lbenicio-minimal-v1-1.6.4 benchmark/string-replacement
lbenicio-minimal-v1-1.6.3 benchmark/string-replacement
lbenicio-minimal-v1-1.6.2 benchmark/string-replacement
lbenicio-minimal-v1-1.6.1 benchmark/string-replacement
lbenicio-minimal-v1-1.5.3 benchmark/string-replacement
lbenicio-minimal-v1-1.5.2 benchmark/string-replacement
lbenicio-minimal-v1-1.5.0 benchmark/string-replacement
lbenicio-minimal-v1-1.4.0 benchmark/string-replacement
lbenicio-minimal-v1-1.3.3 benchmark/string-replacement
lbenicio-minimal-v1-1.3.2 benchmark/string-replacement
lbenicio-minimal-v1-1.3.1 benchmark/string-replacement
lbenicio-minimal-v1-1.3.0 benchmark/string-replacement
lbenicio-minimal-v1-1.2.1 benchmark/string-replacement
lbenicio-minimal-v1-1.2.0 benchmark/string-replacement
lbenicio-minimal-v1-1.1.9 benchmark/string-replacement
lbenicio-minimal-v1-1.1.8 benchmark/string-replacement
lbenicio-minimal-v1-1.1.7 benchmark/string-replacement
lbenicio-minimal-v1-1.1.6 benchmark/string-replacement
lbenicio-minimal-v1-1.1.5 benchmark/string-replacement
lbenicio-minimal-v1-1.1.4 benchmark/string-replacement