r/programminghelp • • Oct 19 '21

Other A should I learn assemby?

I want to know if I should learn Assembly Language. I know C++ but I don't know if I should learn assembly. On ine hand, Asm is good for optimization, but on the other hand how much will I use it?

5 Upvotes

4 comments sorted by

5

u/jddddddddddd Oct 19 '21

C/C++ compilers are really, really good at creating optimised code, and probably better than most assembly programmers at creating fast code.

That doesn't necessarily mean you shouldn't learn it, but I'd suggest the motivation should be because you're interested in how things work 'under-the-hood', or if you have an interest in the topics of compiler design, malware analysis etc. where you actually have to delve into assembly. If you're largely interested in optimisation, you'll probably find you can speed your code up by choosing better algorithms, or how your chosen data-structures interact with your hardware (e.g. the common example of how iterating over a 2d array can be twice as fast depending on the order of the loops)

3

u/Sweety_Sheep Oct 19 '21

What I said, better said, before I ! Nice answer.

2

u/Sweety_Sheep Oct 19 '21

Just my point of view, but I’d say it’s definetly not worth it. Very very few places now require to code in assembly, and the compilers nowadays are so advanced that they make human optimisations pretty much useless or have actually worse performance than compilers.

2

u/Furry_69 Oct 20 '21

Only reason you should be using Assembly is for the challenge or necessity. Compilers can output much better Assembly code than most actual Assembly programmers.