[MacRuby/MacRuby] 8b4d3b: Optimize the rary_splice().
Branch: refs/heads/master Home: https://github.com/MacRuby/MacRuby Commit: 8b4d3bd0129c385668b1933ec646a14591661489 https://github.com/MacRuby/MacRuby/commit/8b4d3bd0129c385668b1933ec646a14591... Author: Watson <watson1978@gmail.com> Date: 2011-06-19 (Sun, 19 Jun 2011) Changed paths: M array.c Log Message: ----------- Optimize the rary_splice(). * before user system total real len == rlen 0.860000 0.000000 0.860000 ( 0.852845) len != rlen 21.180000 0.010000 21.190000 ( 21.186979) * after user system total real len == rlen 0.050000 0.000000 0.050000 ( 0.056620) len != rlen 0.150000 0.000000 0.150000 ( 0.145373) {{{ require 'benchmark' Benchmark.bm(10) do |x| ary = Array.new(1000) tmp = ["a"] * 1100 x.report "len == rlen" do 10000.times do ary[100, tmp.size] = tmp end end x.report "len != rlen" do 10000.times do ary[100, tmp.size - 1] = tmp end end end }}}
participants (1)
-
noreply@github.com