[macruby-changes] [MacRuby/MacRuby] c28465: Performance improvement, when invoke the String#<<...

noreply at github.com noreply at github.com
Mon Oct 10 17:00:13 PDT 2011


  Branch: refs/heads/master
  Home:   https://github.com/MacRuby/MacRuby

  Commit: c28465d209151a538cd041d8b335983dd6ff5b6e
      https://github.com/MacRuby/MacRuby/commit/c28465d209151a538cd041d8b335983dd6ff5b6e
  Author: Watson <watson1978 at gmail.com>
  Date:   2011-10-10 (Mon, 10 Oct 2011)

  Changed paths:
    M string.c

  Log Message:
  -----------
  Performance improvement, when invoke the String#<<.

* before
      user     system      total        real
  0.960000   0.050000   1.010000 (  0.996849)
* after
      user     system      total        real
  0.060000   0.030000   0.090000 (  0.095387)
----
require 'benchmark'
Benchmark.bm do |x|
  str = "abc" * 1000
  add = "foo" * 10
  x.report do
    5000.times do
      str = str << add
      str[0..10]
    end
  end
end




More information about the macruby-changes mailing list