Why games made with C++ are more optimized?

531 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

It is not universally true. However the closer the programing language is to the machine code which actually runs on the processor the more control the programmer have over the code which allows them to write more optimized code. It is things like not following conventions when it would hinder performance, taking minor shortcuts, understanding how different code will get executed in the processor and therefore how it will perform, etc. It does not mean that all C and C++ code will be fast. In fact it takes longer to write code in these languages so there may not be enough time in the project to do other larger performance improvements. And more modern compiler for the higher end languages like Java and C# can actually get better insight into the code then the developer and may do more performance optimization then most people will do on their own. Most AAA titles is written in a number of different languages depending on which works best for the given scenarios. The core of the game engine might be written in highly optimized C++ code that have been perfected over many years and is used for several titles. But the world interactions, animations and scripts are usually written in their own high level language specific to that game engine. Even things like the AI might be written in a completely separate language which is designed to make it quick and easy to work with the AI.

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