Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What makes a programming language fast? [closed]

Tags:

compilation

Or worded in a more relevant way, what characteristics of a programming language influence the fastness of the corresponding generated executable?

Sure that's the compiler which generate the executable which really matter. You may for example imagine something as advanced as a compilation chain able to infer an executable from a natural language description, asking relevant question with provided suggestions to disambiguate if probability to make a good match with given data is too low.

Now C is famous for enabling developers to get really fast executables, "portable assembler". But is that because the language ease the match between the source and target code, and in the same time, ease the development of optimized compilers? Or is that because the developers using C are more sensitive with how it works under the wood and so code with that in mind? Or some other reason?

When did people first start thinking 'C is portable assembler'?

like image 743
psychoslave Avatar asked Dec 01 '25 02:12

psychoslave


1 Answers

C has remains the 'fastest' language because of its flexibility. It doesn't impose a rigid runtime model. Developers are free to create their own runtime structure, architecture, and data structures.

For example, 20 years ago processors were 'slow' (relative to memory speed) and many optimizations focused on looking up results in large tables of precomputed values. Now, processors are fast and memory is slow. Now, optimizations focus on cache efficiency - since large data tables will blow the cache, they are usually avoided and the tasks are shifting back to the processor.

Many languages are much more than just a language. Most modern languages include heavy runtime frameworks and libraries on which the speed depends. These runtime frameworks usually lock in fundamental data structures and memory management models. When hardware changes, inflexible frameworks become inefficient.

Because C compiles predictibly to native object code, and does not impose a heavy runtime, it has, and will continue to handle major hardware architectural changes and will always be among the fastest languages.

like image 100
Joe Avatar answered Dec 04 '25 11:12

Joe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!