david2
- 35
- 84
You guys still use assembly when programming these days?
The discussion revolves around the current use of assembly language in programming, exploring its relevance in various contexts such as embedded systems, performance optimization, and legacy systems. Participants share personal experiences and perspectives on when and why they might resort to using assembly language today.
Participants express a range of views on the necessity and practicality of using assembly language today. While some agree on its continued relevance in specific applications, others argue that modern compilers often negate the need for assembly. The discussion remains unresolved regarding the overall necessity of assembly language in contemporary programming.
Participants acknowledge various limitations, including the dependency on specific hardware, the challenges of maintaining assembly code, and the effectiveness of compilers in generating optimized code. These factors contribute to the nuanced views on when assembly language should be used.
Which one can do relatively easily by using assembly code embedded in C or C++ code. I use MSFT Visual Studio, which supports embedded assembly in 32-bit code, but doesn't allow it in 64-bit code. The workaround is to have a separate assembly file that gets assembled and linked to the rest of your code.newjerseyrunner said:Not very often, but sometimes when I'm profiling I see a chunk of code that I know will be faster if I just convert it to assembly.
Not too many years ago I saw some assembly code in Windows video drivers, an obvious effort to speed up how pixels are updated as quickly as possible. I've also seen some assembly code using MMX extensions that was used in processing audio streams.rcgldr said:As already posted, some aspects of operating systems, such as context switching, interrupt handling, are written in assembly.
There are some specially tuned examples of assembly code, like this 600+ line assembly code for fast crc16 or crc32:Mark44 said:Not too many years ago I saw some assembly code in Windows video drivers, an obvious effort to speed up how pixels are updated as quickly as possible. I've also seen some assembly code using MMX extensions that was used in processing audio streams.
Agreed, but not always the most effective code.rootone said:Modern compilers produce very effective machine code.
This is not the only case, as @Rive points out below.rootone said:Only in the case of writing drivers for unique hardware could human written machine code be an improvement.
Rive said:So at the end, the core of almost every CPU intensive code contains assembly. And when your game is running, 90% of the load generated by the 3D engine will run on assembly. When you render something, it's the same. Convert some videos? That's the same too.
Modern compilers are indeed quite good and can produce code which usually are more optimal than an assembly code written by any average programmer.rootone said:Modern compilers produce very effective machine code.
Only in the case of writing drivers for unique hardware could human written machine code be an improvement.
DCL ASMSUB1 EXTERNAL ENTRY OPTIONS (ASM, INTER, NOMAP); ##-## that declaration allows me to reference a separately assembled routine, in this instance called ##\mathtt{ASMSUB1}##, that is by the PL/I compiler given a ##\mathtt{VCON}## placeholder, which is resolved by the linkage editor when the complete module is built.