LeoPro's blog

By LeoPro, history, 3 years ago, In English

Hello!

Recently I've faced a confusing problem:

I've accidentally re-submitted my solution for problem 1554E - Вы on different compiler. Suddenly I've noticed that its running time has significantly increased.

  • This solution 128134170 takes 1263 ms under GNU C++17 compiler.
  • This solution 128134185 takes 2277 ms under GNU C++17 (64) compiler.
  • You can see that their codes are fully identical.

So, common code with some vectors, self-written modular class and lambdas causes that much time difference — approximately 2 times. The memory also increased (1.5x times), it is also kinda suspicious because I haven't used any pointers.

I've re-written it without lambdas — lifted dfs out of solve (128134438 and 128134426), both execution times have increased in about 200 ms.

I had somewhere heard that vector<bool> is very problematic structure. I even have changed it to vector<int> and resubmitted again (128141354 and 128141276). The execution times have increased a lot and gone closer, but the gap is still quite big (2105 ms / 2807 ms).

So, I am quite at loss, why would 64-bit compiled program take (2 times) more time to execute. Can anyone help me and explain the reason?

P. S. I can hardly think of any good query for googling. This comment is talking about something similiar; however, it isn't answered.

Full text and comments »

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