1

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?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
DontPanic
  • 2,164
  • 5
  • 29
  • 56

2 Answers2

0

actually, it's an Exynos 5 vs. a Snapdragon 820 or an Exynos 8 CPU. the API level also plays a role there; and the number of cores and how many of them are being utilized in parallel. just yesterday read a Q & A, which was comparing C & Java on ARM & x86. or the OS on the S4 might have been compiled with the wrong flags; not totally wrong, but not optimized alike the S7 OS.

you could also benchmark them with AnTuTu ...where the score is about a fifth.

I'd guess that S7 may have a Snapdragon 820 ...

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • Thanks for your speedy reply. I haven't checked the CPU model yet but on Googling I have seen reported differences less than a factor of 2X - not the 50X I'm seeing. As far as optimization, both devices were tested using freshly-built app with identical project settings so unless there's some subtle issue, I don't believe that's the reason. BTW the S4 has a 1.9GHz CPU and the S7 is 2.3GHz, again, not a big difference. – DontPanic Nov 17 '18 at 20:56
0

Well it turns out it was just a bad phone. How embarassing. I borrowed a friend's S3 and my benchmark showed about 50% less performance (~10msec) which I think is a normal expectation for an even older phone. What is strange is my S4 worked perfectly - just slow. Boy, that was a week of wasted time I'll never get back.

DontPanic
  • 2,164
  • 5
  • 29
  • 56