[macruby-changes] [MacRuby/MacRuby] e7e448: Performance improvement in String#[]=

GitHub noreply at github.com
Wed Feb 22 18:16:34 PST 2012


  Branch: refs/heads/master
  Home:   https://github.com/MacRuby/MacRuby
  Commit: e7e448ddcb3debcb8fd6be9f61c694ecc32c4465
      https://github.com/MacRuby/MacRuby/commit/e7e448ddcb3debcb8fd6be9f61c694ecc32c4465
  Author: Watson <watson1978 at gmail.com>
  Date:   2012-02-22 (Wed, 22 Feb 2012)

  Changed paths:
    M string.c

  Log Message:
  -----------
  Performance improvement in String#[]=

does not reset the String's flag as much as possible.

* before
  user     system      total        real
  0.250000   0.000000   0.250000 (  0.255352)

* after
  user     system      total        real
  0.010000   0.000000   0.010000 (  0.012650)

Test Script:
----
require 'benchmark'
require 'stringio'

Benchmark.bm do |x|
  str = "x" * 100000
  io = StringIO.new(str)

  s = "a"
  x.report do
    1000.times do
  io.putc s
    end
  end
end





More information about the macruby-changes mailing list