[macruby-changes] [MacRuby/MacRuby] 99b84b: Performance improvement in StringIO. do not use th...

noreply at github.com noreply at github.com
Sat Oct 15 22:21:27 PDT 2011


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

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

  Changed paths:
    M lib/stringio.rb

  Log Message:
  -----------
  Performance improvement in StringIO. do not use the values via accessor method.

* before
      user     system      total        real
  0.180000   0.000000   0.180000 (  0.155949)

* after
      user     system      total        real
  0.150000   0.000000   0.150000 (  0.131242)

----
require 'benchmark'
require 'stringio'

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

  x.report do
    100000.times do
      io.getc
    end
  end
end




More information about the macruby-changes mailing list