Coding Global Background
Coding Global

Is Python FASTER than C++??

Archiviert 3 years ago
12 Nachrichten
0 Mitglieder
3 years ago
In Discord öffnen
S
shellshock

I'm currently learning C++, so apologies if this is a dumb question. In the attached screenshot, I ran a small experiment out of curiosity. I iterated the word "hi" with its iteration value 100,000 times on both C++20 and Python 3.11.0 & counted how long it would take to finish for each language. I was absolutely baffled at how much faster python ran in this experiment! To ensure that this was not a compiling problem or anything related to the compiler OR console, I reran the experiment with basically the same results. Results in image: Python iterated 100,000 times in 2991034300ns which is 2.99 seconds. C++ iterated 100,000 times in 15212170900ns, which is 15.21 seconds. Why is this happening? Is it because Python is simply faster than C++ now??

Is Python FASTER than C++??

Antworten (12)