[macruby-changes] [MacRuby/MacRuby] 8b4d3b: Optimize the rary_splice().
noreply at github.com
noreply at github.com
Sun Jun 19 02:33:31 PDT 2011
Branch: refs/heads/master
Home: https://github.com/MacRuby/MacRuby
Commit: 8b4d3bd0129c385668b1933ec646a14591661489
https://github.com/MacRuby/MacRuby/commit/8b4d3bd0129c385668b1933ec646a14591661489
Author: Watson <watson1978 at 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
}}}
More information about the macruby-changes
mailing list