Hello!↵
↵
Recently I've faced a confusing problem:↵
↵
I've accidentally re-submitted my solution for problem [problem:1554E] on different compiler. Suddenly I've noticed that its running time has significantly increased. ↵
↵
- This solution [submission:128134170] takes 1263 ms under GNU C++17 compiler.↵
- This solution [submission: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` ([submission:128134438] and [submission: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 ([submission:128141354] and [submission: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](https://mirror.codeforces.com/blog/entry/91824?#comment-804477) is talking about something similiar; however, it isn't answered.
↵
Recently I've faced a confusing problem:↵
↵
I've accidentally re-submitted my solution for problem [problem:1554E] on different compiler. Suddenly I've noticed that its running time has significantly increased. ↵
↵
- This solution [submission:128134170] takes 1263 ms under GNU C++17 compiler.↵
- This solution [submission: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` ([submission:128134438] and [submission: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 ([submission:128141354] and [submission: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](https://mirror.codeforces.com/blog/entry/91824?#comment-804477) is talking about something similiar; however, it isn't answered.