I have noticed a VAST difference in execution time for even a simple loop on two similar but different devices, i.e. a Samsung Galaxy S4 and S7. On the S7 the test below takes ~5 msec and on the S4 ~250 msec, a 50X difference. I'm sure the S7 is faster than the S4, but 50X???
I've tried the Android Profiler (CPU, MEMORY) but didn't see any red flags. The S7 app cooked along at about 10% CPU and the S4 at around 25%.
The code below is a vastly stripped excerpt from my actual app.
//@ Test Timing
public static void timingTest()
{
int i,count=0;
long t1,t2;
String TAG="MYAPP";
t1 = System.currentTimeMillis();
for( i=0; i<4000000; i++ ) { // get start time
count++; // just bump count
}
t2 = System.currentTimeMillis(); // get stop time
String msg=String.format( "ELAPSED = %8.3f sec.", 0.001*(t2-t1) );
Log.i( TAG, msg ); // announce elapsed time
}
I thought it might be differences in optimization, but it made no relative difference if I put real (un-optimizable) processing in the loop. Nor did it make any difference between Debug and Release builds.
I've been beating this for a week now with no added insight.
Anybody have any idea on this or am I just out-of-luck?