Why games made with C++ are more optimized?

521 views

C++ is the language used in almost all AAA titles. I seen youtube tests that show C++ to execute tasks faster than C# or Python for example. But i heard C is faster than C++ also, so why C++?. And what makes C or C++ faster than other languages (except assembly and machine code of course)?

In: Technology

8 Answers

Anonymous 0 Comments

Python is interpreted, not compiled, so the interpreter is effectively turning the source code into machine code as you run the program. This slows it down a whole lot, and other interpreted languages have the same issue. With C or C++, you compile the code into machine code, so you only do that work once per platform, instead of every time you run the program.

Now, you can write something in C and C++, and have them both the same speed, or one faster than the other, depending on what compilers and settings you use, because modern compilers are really good at optimizing code down to equivalent instructions that run faster. Which one ends up faster usually is a question of how clever the compiler is rather than anything inherent to the language.

You are viewing 1 out of 8 answers, click here to view all answers.