diff --git a/README.md b/README.md index 677a7a9..8952926 100644 --- a/README.md +++ b/README.md @@ -1007,24 +1007,6 @@ $ ruby -v code/string/dup-vs-unary-plus.rb String#dup: 3566485.7 i/s - 2.16x slower ``` -##### `String#casecmp` vs `String#downcase + ==` [code](code/string/casecmp-vs-downcase-==.rb) - -``` -$ ruby -v code/string/casecmp-vs-downcase-\=\=.rb -ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14] - -Calculating ------------------------------------- -String#downcase + == 101.900k i/100ms - String#casecmp 109.828k i/100ms -------------------------------------------------- -String#downcase + == 2.915M (± 5.4%) i/s - 14.572M - String#casecmp 3.708M (± 6.1%) i/s - 18.561M - -Comparison: - String#casecmp: 3708258.7 i/s -String#downcase + ==: 2914767.7 i/s - 1.27x slower -``` - ##### String Concatenation [code](code/string/concatenation.rb) ``` diff --git a/code/string/casecmp-vs-downcase-==.rb b/code/string/casecmp-vs-downcase-==.rb deleted file mode 100644 index 027f748..0000000 --- a/code/string/casecmp-vs-downcase-==.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'benchmark/ips' - -SLUG = 'ABCD' - -def slow - SLUG.downcase == 'abcd' -end - -def fast - SLUG.casecmp('abcd') == 0 -end - -Benchmark.ips do |x| - x.report('String#downcase + ==') { slow } - x.report('String#casecmp') { fast } - x.compare! -end