[macruby-changes] [MacRuby/MacRuby] 4c0df5: Performance improvement in StringScanner. do not u...

noreply at github.com noreply at github.com
Sat Oct 15 20:08:38 PDT 2011


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

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

  Changed paths:
    M lib/strscan.rb

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

* before
      user     system      total        real
  0.000000   0.000000   0.000000 (  0.003927)

* after
      user     system      total        real
  0.000000   0.000000   0.000000 (  0.002341)

----
require 'benchmark'
require 'strscan'

Benchmark.bm do |x|
  str = "x" * 500000
  s = StringScanner.new(str)
  x.report do
    1000.times do
      s.concat "a"
    end
  end
end




More information about the macruby-changes mailing list