<<

来源:互联网 发布:2017年病退工资的算法 编辑:程序博客网 时间:2024/06/08 11:33
require "benchmark"
n = 100000
Benchmark.bm do |x|
x.report {
a = "";
for i in 1..n
a += " ";
end;
}
x.report {
a = "";
for i in 1..n
a << " ";
end;
}
end;
# user system total real
# 8.402000 4.656000 13.058000 ( 13.910000)
# 0.080000 0.000000 0.080000 ( 0.080000)
 
原创粉丝点击