Блог пользователя ChtotoSlabovato

Автор ChtotoSlabovato, история, 2 года назад, По-английски

On the last contest I have send identical code on compilers for all 3 versions and while I got time limit on ++17 and ++14, on ++20 it took slightly more than a second(twice as fast). Is C++20 that effective or how else that can be explained?

  • Проголосовать: нравится
  • -19
  • Проголосовать: не нравится

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

What was the code?

»
2 года назад, # |
Rev. 3   Проголосовать: нравится +16 Проголосовать: не нравится

There should be a tangible performance difference between 64-bit and 32-bit compiled code, specially if your program uses 64-bit numeric data processing extensively and the compiled code is running on a 64-bit microprocessor.

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Thank you. Am i right to understand that code on c++14 and c++17 is always 32 bits or i can change that somehow

    • »
      »
      »
      2 года назад, # ^ |
      Rev. 11   Проголосовать: нравится 0 Проголосовать: не нравится

      With pleause.

      RE: Your question

      This depends on the compilation flags passed to the g++ compiler.

      Check the following old blog about that issue.

      About the programming languages

      The Codeforces technical administration team should be able to confirm that the GNU c++14 and c++17 compilers generate 32-bit executable code by default, as I expect.

      Note that the among the g++ compilation flags is the -m switch, which allows changing the default target architectural model used to generate the object code. Using -m32 should generate 32-bit executable code, and using -m64 should generate 64-bit executable code.

      On the other hand, I checked your code, and found that it uses 64-bit integers extensively, as I expected. You may check the following update to your code, which was accepted using c++14.

      167158251