Whats these Time-consuming Operations in java
Автор admin На чтение 1 мин Просмотров 236 Опубликовано
Operation |
Coding |
Time-consuming(ms) |
Local variable Assigning |
i=n; |
1.0 |
Instance Assigning |
this.i=n; |
1.2 |
int increasing |
i++; |
1.5 |
byte increasing |
b++; |
2.0 |
short increasing |
s++; |
2.0 |
float increasing |
f++; |
2.0 |
double increasing |
d++; |
2.0 |
Null Loop |
while(true) n++; |
2.0 |
Ternary expression |
(x<0) ?-x : x |
2.2 |
Arithmetic call |
Math.abs(x); |
2.5 |
Array Assigning |
a[0] = n; |
2.7 |
long increasing |
l++; |
3.5 |
method call |
funct(); |
5.9 |
throw or catch excpetion |
try{ throw e; }or catch(e){} |
320 |
synchronise method call |
synchMehod(); |
570 |
newObject |
new Object(); |
980 |
New Array |
new int[10]; |
3100 |