codexile's blog

By codexile, 10 years ago, In English

Please consider the following 3 submissions:

The same code has been executed with Java 6->7->8 compilers. Outcome is:

  • 702 ms (Java 6);
  • 1000 ms TLE (Java 7);
  • 998 ms (Java 8).

I assume that the issue is in 32-bit and 64-bit based compilers. I guess that CodeForces uses 32-bit one for the Java 6 only.

So I've been more than surprised (it's not like 850ms vs 900ms — it's 30% faster!). I'd like to get some explanations from the community on this matter. I can also see that many people here use Java 7 or higher. So what's the reason behind this (having the problem from above?)

Maybe this solution was just specific (e.g. memory usage and stuff) or kinda buggy? Or we can see such performance degradation on every submission?

Anyway, let it be at least a friendly reminder for all Java-users to think twice, before pressing the "Sumbit" button.

  • Vote: I like it
  • +28
  • Vote: I do not like it

»
10 years ago, # |
Rev. 2   Vote: I like it +7 Vote: I do not like it

I submitted the same code twice (Java 6/8) just now, and got a kind of different result from yours.

http://codeforces.com/contest/408/submission/6397501 http://codeforces.com/contest/408/submission/6397506

Java 6 : 109 ms Java 8 : 217 ms

It's interesting to know though.

I'll consider using different version of Java when I got TLE for the solution I'm really sure about.