Why Use Assembly Language in Modern Programming?

  • Thread starter Thread starter ChrisLeslie
  • Start date Start date
  • Tags Tags
    x86
Click For Summary

Discussion Overview

The discussion revolves around the use of assembly language in modern programming, exploring its relevance, applications, and comparisons with high-level languages (HLLs). Participants share their experiences and thoughts on various aspects of assembly language, including its advantages and disadvantages, specific use cases, and performance considerations.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants inquire about the types of assemblers used and their respective pros and cons.
  • One participant suggests that assembly language might primarily be used for performance-critical sections, such as tight loops or shader routines in graphics processing.
  • Another participant argues that a good optimizing compiler can often produce more efficient code than hand-optimized assembly, citing the compiler's understanding of CPU architecture.
  • There is mention of specific scenarios where assembly is necessary, such as generating precise machine code for hardware initialization or low-level power management.
  • A participant shares a personal anecdote about using assembly for chip-level programming, emphasizing its necessity for processes requiring microsecond precision.
  • Discussion includes varying opinions on the effectiveness of different assembly language compilers, with references to both Linux and Microsoft versions.

Areas of Agreement / Disagreement

Participants express differing views on the necessity and efficiency of assembly language compared to high-level languages, indicating that multiple competing perspectives remain without a clear consensus.

Contextual Notes

Some assumptions about the contexts in which assembly language is used may not be fully explored, such as the specific requirements of different applications or the limitations of high-level languages in certain scenarios.

ChrisLeslie
Just curious about how many forum members use assembler programming, and:
1. what sort of assembler they may use,
2. the pros and cons of various assemblers,
3. capability of assemblers vs HLL's,
4. their thoughts on 16 vs 32 bit,
5. and why they may use assemblers at all?

Chris
 
Technology news on Phys.org
Not something I know much about but I would imagine that it'd only be used for the tightest of loops, things like shader routines for video processors and stuff. An interesting use of assembler was the graphic system in Quake, they couldn't quite get it to run well on a 486 but nevertheless I think it was a great achievement.
 
A good optimizing compiler (and there are a lot of bad ones!) should be able to generate code that runs tighter than "simple-minded" hand-optimised assembler, because the compiler writers should know more details about exactly how the CPU works than most application programmers. For example, reordering instructions to get maximum overlap of fetch-execute, look-ahead branch resolution, optimum use of the cache, etc.

I suspect the main reason for using an assembler now would be if you need to generate some precise sequence of machine code instructions for some reason - for example at power on reset, or putting the CPU into "sleep mode" and waking it up again.
 
My brother-in-law used assembly for chip level programing, if you ahve to make a process work in micro-seconds you use assembly. Th Linux compilers are pretty good, last time i tried the microsoft version of assembly lanugauge wasn't too bad either.
 

Similar threads

  • · Replies 102 ·
4
Replies
102
Views
4K
Replies
16
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 18 ·
Replies
18
Views
7K
Replies
60
Views
18K
Replies
15
Views
11K
Replies
10
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
3
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K