09/02/12 22:10:44
以下のコードのRun()の実行時間が型によって全然違うんだが仕様?
環境はUbuntu上でMonoのバージョンは2.2
VC#でもコンパイルしてみたが,intもlongもあまり差は無かった
class hoge{
static void Main(){
Run(new int[10000]);
Run(new long[10000]);
}
static void Run<T>(T[] a){
Stopwatch sw=Stopwatch.StartNew();
for(int i=0;i<100;i++)
Array.Reverse(a);
sw.Stop();
Console.WriteLine("{0}: {1} s",typeof(T),sw.Elapsed.TotalSeconds);
}
}
実行結果
System.Int32: 0.0096311 s
System.Int64: 2.4027608 s