W
W
WisdomButcher2020-09-03 23:56:38
Programming languages
WisdomButcher, 2020-09-03 23:56:38

Is it possible to create a language that would replace C in terms of performance?

Hello!
Am I correct in thinking that C programs run faster than programs in other languages ​​after Assembler? And is it theoretically possible to build a better compiler than C in the coming years? Provided that programmers have a good command of languages.
Thanks for the replies.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Saboteur, 2020-09-04
@saboteur_kiev

Hello!

Am I correct in thinking that C programs run faster than programs in other languages ​​after Assembler?

No.
Most compiled languages ​​compile program text directly into machine code.
It's just that in C, as in one of the low-level languages, you can more control the behavior of the compiler and prepare the program text for it. But programs are different, if you take a specific algorithm and compare - I think comparable speed can be achieved everywhere.
Yet again. It is not easy to write an algorithm in assembler - in order to overtake a modern compiler in speed, you need to know the processor architecture better than those who write the compiler know it. And it's not easy.
And is it theoretically possible to build a better compiler than C in the coming years? Provided that programmers have a good command of languages.

Good command of the language is not as critical as understanding the architecture of processors. To use all the capabilities of modern processors, you need to know them, follow them, and negotiate with processor manufacturers on the exchange of knowledge and documentation.
A sudden new language in this regard is hardly possible in the coming years.
Yet again. "quick programs" what is it?
Somewhere faster than Go, somewhere C++, somewhere pure asm, somewhere even python.
The speed of programs is usually not so critical. And a specific algorithm can be licked on almost everything.

R
Roman Mirilaczvili, 2020-09-04
@2ord

And is it theoretically possible to build a better compiler than C in the coming years?
Unlikely. A lot of man-hours have been invested in this language. Since it is a generally accepted standard, it is easier to modify extensions for your needs than to develop a compiler from scratch.
Am I correct in thinking that C programs run faster than programs in other languages ​​after Assembler?
Not necessary. Take, for example, the comparison of Web Framework Benchmarks
https://www.techempower.com/benchmarks/
The C program took only 6th place in the list.
What makes C efficient ("fast", but not only)?
GoTo inline functions
, assembler inserts,
register variables,
address arithmetic
, various "hints" for the compiler, the type of processor vector instructions, and others.
In order to replace the C language, it is necessary to:
invest a lot of man-hours by creating a compiler that generates code more efficiently than C
develop a better toolchain than the one currently available.
Additional links:
icps.u-strasbg.fr/~bastoul/local_copies/lee.html
ftp.cvut.cz/kernel/people/geoff/cell/ps3-linux-doc...
https://ispc.github.io/

Y
Yo JLa, 2020-09-10
@blanger

Almost the same language has already been created. At the same time, it is many times more secure, as both Microsoft and Linux developers implement its support and compilation into existing codebases.
Its name is Rust.
And yes, creating a language is far from creating a compiler for such a new language and other tools.
This is many man-hours, that is, years of development.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question