Flatfoot's blog

By Flatfoot, 10 years ago, In English

I submitted the problem 20C - Алгоритм Дейкстры? with two different Java compilers. The results are as follows:

Java 7: 7625239 Time: 466 ms Memory: 12400 KB

Java 8: 7625386 Time: 1184 ms Memory: 8500 KB

I expected Java 8 to be faster. However, to my surprise the program runs more than two times slower under Java 8 than under Java 7 which really surprised me! Does anyone have an explanation for this or experienced something similar?

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

| Write comment?
»
9 years ago, # |
  Vote: I like it +1 Vote: I do not like it

...Java 8 is much slower than Java 7. Running an app using Java 8, I noticed a significant delay. I had to downgrade to Java 7 to get performance back to acceptable speed level.

»
9 years ago, # |
  Vote: I like it +2 Vote: I do not like it

I think that Petr, Egor and andrewzta should know a good explanation for that.

I think it is probably something like "Java 8 takes more time for more clever JIT-optimization in a hope that program will be long-living" (which is false on competitions) or just another garbage collection strategy.