+ 6
Different C++ compiler behaviors?
I executed a C++ program in an offline Turbo C++ compiler first. It took 342+ seconds to execute. When the Java version of the code executed in 8 seconds in an online compiler, I thought that C++ is slower. I even made a post on that (https://www.sololearn.com/discuss/299927/?ref=app). Later, I executed the code in 2 online GCC C++ compilers. One of them took 10 seconds but the other took only one second. These values stayed the same in multiple trails. Any idea on why the different behaviors of compilers?
10 Respostas
+ 10
Turbo C++ is old technology...very old. I wonder if Borland still exists.
+ 9
Online compilers are subject to internet traffic I would guess. Did you make several tests?
+ 7
You're not going to get comparable results by using online compilers. You can't reliably say that the difference in runtime is the fault of the different compilers; it's most likely due to the differing specifications of the machines that the code is being executed on, and the load they're under at any given time from other users.
To perform proper benchmarks, you need to run all tests on the same machine under the same conditions.
+ 7
@Dimas : Thanks. But, there is not much difference in execution times with different compilers according to the page you linked.
+ 5
@Squidy : I am wondering why the offline Turbo C++ compiler took 343 seconds. Is it that slower?
+ 5
@Helioform : Executed the same code in those 2 online compilers 10 times and got almost same results.
+ 5
@Helioform : I used only online compilers till now. When I was suggested to use an offline compiler (in the post I linked), I downloaded that. Then I found in Wikipedia that Turbo C++ is discontinued. But I didn't read anywhere that it's slow.
+ 1
use clang instead of g++