Bruce Eckel's Thinking in Java | Contents | Prev | Next |
Operation
|
Example
|
Normalized
time
|
Local
assignment
|
i
= n;
|
1.0
|
Instance
assignment
|
this.i
= n;
|
1.2
|
int
increment
|
i++;
|
1.5
|
byte
increment
|
b++;
|
2.0
|
short
increment
|
s++;
|
2.0
|
float
increment
|
f++;
|
2.0
|
double
increment
|
d++;
|
2.0
|
Empty
loop
|
while(true)
n++;
|
2.0
|
Ternary
expression
|
(x<0)
? -x : x
|
2.2
|
Math
call
|
Math.abs(x);
|
2.5
|
Array
assignment
|
a[0]
= n;
|
2.7
|
long
increment
|
l++;
|
3.5
|
Method
call
|
funct( );
|
5.9
|
throw
and
catch
exception
|
try{
throw e; } catch(e){}
|
320
|
synchronized
method call
|
synchMethod( );
|
570
|
New
Object
|
new
Object( );
|
980
|
New
array
|
new
int[10];
|
3100
|