運算符的運行時間比較
運算 示例 標準時間
本地賦值 i=n; 1.0
實例賦值 this.i=n; 1.2
int增值 i++; 1.5
byte增值 b++; 2.0
short增值 s++; 2.0
float增值 f++; 2.0
double增值 d++; 2.0
空循環 while(true) n++; 2.0
三元表達式 (x<0) ?-x : x 2.2
算術調用 Math.abs(x); 2.5
數組賦值 a[0] = n; 2.7
long增值 l++; 3.5
方法調用 funct(); 5.9
throw或catch異常 try{ throw e; }或catch(e){} 320
同步方法調用 synchMehod(); 570
新建對象 new Object(); 980
新建數組 new int[10]; 3100