You are viewing a single comment's thread from:

RE: Creating faster C/C++ binaries without changing a single line of code

in #development9 years ago (edited)

Thanks :D I will try to explain it in simple terms even for non-programmers.

When a programmer writes some code, like

"IF temp_sensor > 150 THEN shutdown" (when the temperature rises over 150, then activate a shutdown routine),

...this then needs to be translated from human-readable language to machine language that our CPU can understand.

The machine language is generated by a "compiler". A program that converts our language to the language of the cpu.

Each compiler may take the human-readable code and create different machine code. If you have two compilers, you may have one which creates machine code that takes 1 second to perform the desired function, and another compiler producing more inefficient machine code which takes 2 second to perform it.

So what you want to do is to find the best possible compiler for your speed-critical operations, in order to waste as little time as possible. And this can be done by editing a text file (known as Makefile) which dictates how a program will be compiled file-by-file. So some files you send through one compiler, and some others through another compiler, trying to reduce the time wasted by inefficient machine code.

For example, a web browser consists of thousands of program files. Some are very speed critical - like video algorithms. If these are slow, then your experience in watching youtube suffers. You want the best possible compilers on the job to get the smoothest video possible.

Sort:  

I've officially entered the matrix! :-)

Thank you for the explanation - that made sense.