eli5: How is C still the fastest mainstream language?

845 views

I’ve heard that lots of languages come close, but how has a faster language not been created for over 50 years?

Excluding assembly.

In: 2072

19 Answers

Anonymous 0 Comments

The correct phrase is like “it is possible to implement language A to be faster with some programs than language B on the given hardware”, not “language A is faster than language B”.

Anyway, that’s not entirely true. Fortran is faster than C. The reason is that in C there is a **restrict** keyword, which is rarely used, while in Fortran all libraries are “restrict” by default. Also the typical implementation of printf and other functions with variable number of arguments are slow. Fortran avoids this by making i/o part of the language itself, not standard library.

However, Fortran can be 1% faster, but is more difficult for a programmer.

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