Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the practical advantages of learning Assembly?

Most people suggest that learning assembly is essential, its important to know the underlying workings of the computer, and so forth. But what I'm looking for are some practical suggestions that will make the effort of learning Assembly to be worth it.

What are your suggestions? What am I missing out on by not learning Assembly and pointers/memory management in general?

like image 582
Ali Avatar asked Jan 07 '09 23:01

Ali


2 Answers

I think the main practical advantage to learning low-level things like assembly language, pointers, and memory management is that when you're writing or reviewing high-level code you're better able to instinctively or subconsciously spot performance issues or other pitfalls.

An average developer, might write a simple loop and think, "This code iterates over a set of integers and writes each to the console."

An expert developer might write the same loop and think, "This code iterates over a set of integers, and has to box each element to call the ToString method and ToString has to format the string in base 10 which is somewhat non-trivial, and then both the boxed integer and the formatted string will soon be eligible for garbage collection as no references will remain, and the first time this method runs, it will need to be JIT'ed..." and so on.

9 times out of 10, it may not matter. But that 1 time out of 10, the expert developer is likely to notice a problem in code that the average developer would never think to consider.

like image 73
C. Dragon 76 Avatar answered Nov 18 '22 13:11

C. Dragon 76


You need to learn to read assembly so you can figure out what goes wrong when a complex statement bombs out. The CPU debug window shouldn't be a mysterious place.

like image 5
Loren Pechtel Avatar answered Nov 18 '22 12:11

Loren Pechtel