[macruby-changes] [MacRuby/MacRuby] a0fc10: improve a performance slightly in str_each_uchar32...

GitHub noreply at github.com
Thu Dec 27 23:54:43 PST 2012


  Branch: refs/heads/master
  Home:   https://github.com/MacRuby/MacRuby
  Commit: a0fc10944f4d1196ea7b80168ba92a9adb6a4748
      https://github.com/MacRuby/MacRuby/commit/a0fc10944f4d1196ea7b80168ba92a9adb6a4748
  Author: Watson <watson1978 at gmail.com>
  Date:   2012-12-27 (Thu, 27 Dec 2012)

  Changed paths:
    M string.c

  Log Message:
  -----------
  improve a performance slightly in str_each_uchar32_starting_from() when string is only ascii code range

* before
Rehearsal ------------------------------------------
[]=      4.250000   0.000000   4.250000 (  4.255847)
index    3.800000   0.010000   3.810000 (  3.797601)
--------------------------------- total: 8.060000sec
        user     system      total        real
[]=      4.260000   0.010000   4.270000 (  4.253540)
index    3.800000   0.010000   3.810000 (  3.798211)

* after
Rehearsal ------------------------------------------
[]=      3.670000   0.010000   3.680000 (  3.669379)
index    3.190000   0.000000   3.190000 (  3.195554)
--------------------------------- total: 6.870000sec
        user     system      total        real
[]=      3.680000   0.010000   3.690000 (  3.679104)
index    3.200000   0.010000   3.210000 (  3.199752)

Test Code:
----
require 'benchmark'

str = "hoge" * 10000 + "\n"

Benchmark.bmbm(7) do |x|
  x.report "[]=" do
    10000.times do
      str2 = str.dup
      str2["hoge\n"] = "foo"
    end
  end

  x.report "index" do
    10000.times do
      str.index("\n")
    end
  end

end


  Commit: 116bf071a79176c983357ab43ef4b601470c39d4
      https://github.com/MacRuby/MacRuby/commit/116bf071a79176c983357ab43ef4b601470c39d4
  Author: Watson <watson1978 at gmail.com>
  Date:   2012-12-27 (Thu, 27 Dec 2012)

  Changed paths:
    M string.c

  Log Message:
  -----------
  refactor


Compare: https://github.com/MacRuby/MacRuby/compare/b6b77a63f05f...116bf071a791


More information about the macruby-changes mailing list