eli5: How is C still the fastest mainstream language?

750 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

I would argue the premise of your question is fundamentally flawed.

Assembly isn’t inherently fast. It’s lower level. Something fast can be written in it by a skilled engineer, but most engineers will probably write something that performs worse than if he they written it in another language. Their code will probably contain bugs too.

Language compilers are extremely smart and one of the functions of them is to optimize code. And the reality is the vast majority of people can’t outsmart the compiler when it comes to trying to optimize by hand, it’s not going to be time well spent.

In the real world, programmers should worry about algorithms. For example, if you need to computer something based on an input of “n” items, writing code that can do it in n^2 amount of effort rather than n^3 amount of effort is probably time better spent than writing in a lower level language.

The reason to choose a language these days for most people ought to be driven but purpose and need, rather than worrying what’s the absolute fastest.

There are definitely applications where you need to write in C or assembly, but these days those are far and few.

I say this as someone who has written compilers.

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