3 ms·
Java 3.326788s, C++ 8.46879s on my machine. This is interesting. Code seems analogous.
by georgehaake 13y ago
Java 3.326788s, C++ 8.46879s on my machine. This is interesting. Code seems analogous.
- deletes 13y agoCode in the question is a bad test example. As the answer shows, different compilers can optimize the code in different ways to make the outer loop almost meaningless. A better test would have 100000 different arrays to test. Did you enable optimizations in C++ and disable adaptive optimization in java?