How do you configure your runtine and the compiler to get a maximum of performance ?
At first, I guess one should use the comiler flag g:none, to disable the generation of debugging info. Then one has to choose the runtime: AFAIK: sever should starts up slower (as the client), but tends be faster afterwards - right ?
Are there any other important flags (like Xmx,.) or configurations, that have a recongizable affect on the performance ?
The reason, why I am asking is that due to my experience the byte code comiler and even more important the JIT, do very few optimzations. In my test cases the compiler doesn’t inline properties often (especially when thaemethods override an abstract one) and auto boxing like the following aren’t optimized well:
(any ideas why?)
public class Test
{
private final float[] elems = new float[16];
public Test()
{
// fill elems with random values
..
}
public Float foo(int index)
{
return this.elems[index];// or even: return this.bar(index);
}
public float bar(int index)
{
return this.elems[index];
}
public static void main(String[] args)
{
for(int loop..
test();
}
public static void test()
{
Test test = new Test();
long time = System.nanos..
float sum;
// test bar
sum = 0.0f;
for(int loop...
for(int index...
sum += test..bar(index);
print(time, sum);
// test foo: (is 'much' slower than bar)
sum = 0.0f ;
for(int loop...
for(int index...
sum += test.foo(index);
time = System.nanos.. - time;
print(time, sum);
}
}
best regards
- michael