Branch: refs/heads/master Home: https://github.com/MacRuby/MacRuby Commit: a798d2b87e38f38ca722fe7a29346855984a6e8d https://github.com/MacRuby/MacRuby/commit/a798d2b87e38f38ca722fe7a2934685598... Author: Watson <watson1978@gmail.com> Date: 2011-10-07 (Fri, 07 Oct 2011) Changed paths: M string.c Log Message: ----------- Performance improvement in String#slice!. does not reset a flag of string in str_splice when does not replace the string. * before user system total real slice with ASCII 0.010000 0.000000 0.010000 ( 0.006842) slice! with ASCII 0.410000 0.000000 0.410000 ( 0.405871) slice! with UTF8 0.600000 0.000000 0.600000 ( 0.596322) * after user system total real slice with ASCII 0.010000 0.000000 0.010000 ( 0.006411) slice! with ASCII 0.020000 0.000000 0.020000 ( 0.017780) slice! with UTF8 0.410000 0.000000 0.410000 ( 0.402712) ---- require 'benchmark' Benchmark.bm(18) do |x| str = "abcdef" * 10000 str2 = "いろは" * 10000 x.report "slice with ASCII" do 5000.times do str.slice(0, 10) end end x.report "slice! with ASCII" do 5000.times do str.slice!(0, 10) end end x.report "slice! with UTF8" do 5000.times do str2.slice!(0, 10) end end end