[macruby-changes] [MacRuby/MacRuby] f16656: improve a performance in String#delete

GitHub noreply at github.com
Sat Dec 29 00:55:20 PST 2012


  Branch: refs/heads/master
  Home:   https://github.com/MacRuby/MacRuby
  Commit: f166560cd6cb658eb540330319a3d15ec34d25dc
      https://github.com/MacRuby/MacRuby/commit/f166560cd6cb658eb540330319a3d15ec34d25dc
  Author: Watson <watson1978 at gmail.com>
  Date:   2012-12-29 (Sat, 29 Dec 2012)

  Changed paths:
    M string.c

  Log Message:
  -----------
  improve a performance in String#delete

* before
       user     system      total        real
delete   0.960000   0.010000   0.970000 (  0.968533)

* after
       user     system      total        real
delete   0.200000   0.000000   0.200000 (  0.185961)

Test Code:
----
require 'benchmark'

str = "hoge abc" * 100

Benchmark.bm(7) do |x|
  x.report "delete" do
    10000.times do
      str.delete("abc")
    end
  end
end





More information about the macruby-changes mailing list