Burunduk1's blog

By Burunduk1, history, 6 years ago, translation, In English

I'd like to know, how to launch dfs on java, to make it work pretty fast. $$$n = 2\,300\,000$$$.

Submit 54911336, says that on codeforces (windows, java32 1.8.0_162) time in dfs = 126ms.

Locally (windows, java64 11.0.1) i have time in dfs = 13913ms. The difference is 100 times!

Petr (windows, java 1.8.0_181) gets 15 seconds.

Command line options are java -XX:NewRatio=5 -Xms8M -Xmx512M -Xss64M. Taken from here.

How long it works for whom? (i'm interested in time, os/processor, java version, command line options)

How to reach 126ms locally?

UPD:
Locally if i add -XX:TieredStopAtLevel=1 (help) i get 387ms.
Command line options "exactly as on codeforces" locally on java64 give me the same time 13913ms $$$\pm\varepsilon$$$. So it's important to use java32.

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

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been translated by Burunduk1 (original revision, translated revision, compare)

»
6 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Difference between your local run "exactly as on codeforces" and real Codeforces run is explained with the fact that locally you use 64-bit JRE, but we use 32-bit JRE.

  • »
    »
    6 years ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    Thanks. I'll fix the post.

    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it +5 Vote: I do not like it

      That explains everything, by the way. 32bit VM only has C1 support (C2 is not supported for 32 bits VMs), so by running 64bit VM with -XX:TieredStopAtLevel=1 you essentially run it with the same compiler (C1 only) but in 64bit mode.

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I believe that with -XX:TieredStopAtLevel=1 but without -XX:+UseSerialGC the total consumed cpu time is greater than measured in your code because GC will effectively use multiple threads. I think that with -XX:+UseSerialGC the total running time can grow a little but the total consumed cpu time will decrease noticeably. For sure, all online judges measure total time.