Is there a way to control the optimization level of the java compiler that Eclipse uses when building a project? Or is this question not relevant anymore, is all optimization deferred to the vm?
The reason I'm asking is that I recently wrote a quick test doing this:
private static int test_f(int i) { return i * 42; }
...
int z = 41;
for(int i = 0; i < 10000; ++i) { z = z*42; } // this loop runs in X seconds
for(int i = 0; i < 10000; ++i) { z = test_f(z); } // this loop runs in 10*X seconds
The results of this tests imples test_f() is not being inlined, even though it really is a prime candidate for it. It should also be possible to do this inlining at compile time.
The environment/target vm is Android/Dalvik.
UPDATE: I investigated this further, and it turns out Dalvik doesn't do inlining at this date.