[macruby-changes] [MacRuby/MacRuby] e0f5b8: improve the performance of string interpolation

GitHub noreply at github.com
Mon Jun 10 01:17:09 PDT 2013


  Branch: refs/heads/master
  Home:   https://github.com/MacRuby/MacRuby
  Commit: e0f5b8147e3392c5e07855a34930d0216fc97ddf
      https://github.com/MacRuby/MacRuby/commit/e0f5b8147e3392c5e07855a34930d0216fc97ddf
  Author: Watson <watson1978 at gmail.com>
  Date:   2013-06-10 (Mon, 10 Jun 2013)

  Changed paths:
    M string.c

  Log Message:
  -----------
  improve the performance of string interpolation

This patch will reduce the count of reallocation.

* before
      user     system      total        real
 10.900000   0.280000  11.180000 (  9.054008)

 * after
     user     system      total        real
 8.880000   0.230000   9.110000 (  7.260528)

Test Code:
----
require 'benchmark'

Benchmark.bm do |x|
  part = "a" * 10

  x.report do
    1000000.times do
      "#{part} #{part} #{part} #{part} #{part} #{part} #{part}"
    end
  end
end





More information about the macruby-changes mailing list