eli5: How is C still the fastest mainstream language?

758 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

Maybe this will help you understand the relationship between low-level languages (like C) and higher-level languages.

Think of assembly as working with words. These words are the basic units the processor knows how to execute. Simple actions. These are usually verbs, like: read, store, increment, shift, jump, etc.

Think of low-level languages (like C) as working in sentences. Small, basic concepts. Things like: read memory from here and store it there, read a value and increment it, promote this 8-bit value to a 32-bit value, etc.

Think of high-level languages (like Java) as working in paragraphs. Larger concepts can be written without writing each individual sentence. Things like: Iterate over a collection of items performing an action on each one, run a block of code in a different thread of execution, slice a two-dimensional array to retrieve a particular column, blit a memory buffer to a display buffer, etc.

At some level, all languages are translated to the equivalent machine code. Paragraphs are broken up into individual sentences and sentences are broken down into words. The farther away from words you start, the more likely that the translation efficiency suffers. This leads to more words to say the same thing.

C is efficient because it’s almost as close to programming in words as possible (in this analogy). Translation of it’s sentences to words is straightforward and efficient.

It’s not an easy task to improve it’s performance because it’s almost at the limit of writing as close to words as we can while still maintaining an environment where programs can be written in a more user-friendly way.

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