計測

テストするとき、1,2,3…と時計に合わせて数えている。たいして時間にこだわるようなものを作らないからだけど。みなさんどうしてんすかね。
さすがに面倒なので最低限のを作った。linuxはコマンドあるんでしたっけ。分布も調べる?
こう、統計は日常で役に立つこともあるけど素数とか因数分解とか使う機会はないですねえ。

# timerun.rb
# research run time,


if ARGV[0]==nil ;puts $0+", usage: 'file.rb' 'repeat num'";exit;end

an=[]
x=1
x=ARGV[1].to_i if ARGV[1]!=nil

x.times{
 a= Time.now.to_f
 `c:\\ruby\\bin\\ruby #{ARGV[0]}`
 b= Time.now.to_f
 an+=[b-a]
 # puts sprintf("[ %.2f sec. ]", i)
}

an.each{|i|puts sprintf("[ %.2f sec. ]", i)}


http://d.hatena.ne.jp/secondlife/20071011/1192103107
聴く。rubyは';'入れるようにも入れないようにも出来るから向いてるかも。

# t240 o5 v7 q7
# timerun.rb
# research run time,


if ARGV[0]==nil ;puts $0+", usage: 'file.rb' 'repeat num'";exit;end

an=[]
x=1
x=ARGV[1].to_i if ARGV[1]!=nil

x.times{
 a= Time.now.to_f
 `c:\\ruby\\bin\\ruby #{ARGV[0]}`
 b= Time.now.to_f
 an+=[b-a];
 # puts sprintf("[ %.2f sec. ]", i)
}

an.each{|i|puts sprintf("[ %.2f sec. ]", i)};