We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a30498b commit e028d50Copy full SHA for e028d50
benchmark/string-replacement
@@ -0,0 +1,13 @@
1
+require 'benchmark/ips'
2
+
3
+def str
4
+ 'http://baruco.org/2014/some-talk-with-some-amount-of-value'
5
+end
6
7
+Benchmark.ips do |x|
8
+ x.report('#tr') { str.tr('some', 'a') }
9
+ x.report('#gsub') { str.gsub('some', 'a') }
10
+ x.report('#gsub!') { str.gsub!('some', 'a') }
11
+ x.report('#sub') { str.sub('some', 'a') }
12
+ x.report('#sub!') { str.sub!('some', 'a') }
13
0 commit comments