Is assembly the only low-level programming language, and if not, is it most widely used?

Recently, I began to study assembly, and as I surfed the Internet, I see that more and more people say that assembly is not useless, but also you should not spend time programming in a language that requires such time and compared to high languages level. Is the effectiveness between a high-level and a low-level language program not really noticeable enough to pay attention to today, and is there an even lower level of language, for example, an assembly that is more widely used?

+6
source share
4 answers

Is the effectiveness between a high-level and a low-level language program one really is not even noticeable enough to pay attention to at present

Often compilers generate a much better build than developers can write. There are certain developers who can defeat the compiler. But since writing low-level code requires more attention to detail and is more difficult to write and maintain, usually only small specific pieces of code are usually used in the assembly to build it. The difference may be noticeable. But it can also be unobvious if developers make false optimizations.

I would recommend you read Michael Draft book for Abrash graphics - it has many opportunities for assembly and optimization + nice stories from real life.

and is there another low level language such as an assembly that is more widely used?

Assembler is probably the lowest level programming language for applications. The only other resort is to write binary code manually, but binary operation codes can hardly be called a "language".

However, programming goes beyond software. It is also necessary to program the hardware. There are hardware description languages ​​(HDL) that you can use to program your hardware (i.e. you can create your own processor). The most popular HDL languages ​​are Verilog and VHDL .

+10
source

Writing an assembly was appropriate in simpler times. Back when the code generator in the C compiler was not very smart, and it was easy to predict the execution time of machine code.

What’s next, a person cannot defeat either the ummahs built into a modern code generator or his tireless attention to detail. Detailed information needed to know exactly when you insert a cache prefetch so that data is available at the right time. And how to reorder instructions correctly, you get better super-scalability. And pasting the nops right to the right, so that the transition goals are aligned. And how to mechanically deploy the loop. And how to use the automatic parallelization provided by SIMD. Etcetera. And do it not once, but again and again when the code changes.

+7
source

higher level language compilers are getting smarter every day. In the past, assembler tricks could significantly increase performance. Compilers currently implement many of these tricks.

Examples are: moving instead of dividing, managing the program counter in the jump table for a switch / case, nesting functions if they are used only once, etc.

There is still room for optimization, but the performance gain will be so low that it is better to use a higher level language and switch to maintainability.

+3
source

Well, the “assembly” is actually rather a collection of different varieties. It depends on the architecture for which you are programming. For example, the build for x86 can (and will) be very different from the build for ARM, or MIPS, or any architecture you can think of. This is due to the fact that the assembly is a one-to-one translation of the binary code executed by the processor. Because different architectures have different sets of instructions, their assembly language is also different.

So, the assembly is the lowest that you can use without writing simple binary code. But this is not a specific language, not a group of languages. So, if you are talking, for example, about x86 assembly, and you are comparing this to another language with an equal low level, you will find that this other language will also represent several build options. Again, this would be for a different architecture, so it would not be very useful either.

+3
source

Source: https://habr.com/ru/post/921151/


All Articles