Is there still any value in learning assembly languages today? [closed]

Specifically for a game programmer.

If you really needed some assembly routines you could look for help, whereas back in the 80s/90s it was one of the mainstream languages. I read that compilers can generally equal (or beat) most hand written assembly code, so unless you are an embedded programmer who can only program some device in assembly, for example, is there any real point in learning it nowadays?

7

Assembly was never a mainstream language. You learn it for the same reasons that people learned it in the 80s/90s, and before that: it’s close to the metal.

Learning assembly language:

  • Teaches you how the machine works, and
  • Gives you access to the best possible performance (in theory).

I say “in theory,” because it doesn’t come without a cost. Everything you get for free in higher level languages (math, I/O, some organizational structure) is a slog in assembly language, because you’re literally building everything from scratch.

That’s why, when assembly is used, you’ll typically find it in specialized library methods and in inline code, while a higher-level language does most of the heavy lifting. The assembly language optimizes that small bit of the code that will benefit the most from performance optimization.

Modern compilers give you most of the performance benefits of assembly language, without the cognitive cost. But learning assembly still teaches you how the machine works at a deep level, and that knowledge will influence your software development long after you learn assembly, even if you never use assembly all that much.

If you do decide to learn assembly, I recommend that you learn it on an embedded device, like an Atmel AVR. The number of opcodes to learn is smaller than a computer, and there’s no operating system to worry about.

3

I think one of the values of assembly languages today that is often overlooked is the didactic value. I would contend that an assembly language is the best entry language for someone who has never programmed before. Why? Because it is simple and bare. In assembly you have basically three elements: Registers, opcodes and memory addresses. Learn how to mix-and-match those three basic elements and you can do a lot. Now take C for instance, for someone who has never coded before, C is pretty darn complex. Right out of the bat you have functions, #includes, macros, structs and more. That’s a lot to take in. Go to a higher level language like Java and then you have the whole concept of classes and objects that must be understood beforehand. My personal opinion is that when learning something new, I prefer to start small. This is why I think assembly is an overlooked didactic tool.

Now on practical aspects, when you get the job of optimizing code, there is also value in being able to read and understand assembly. A lot of optimizations are about reading compiled code and seeing where the compiler is screwing up and how to change your higher level code in a way to allow the compiler to generate faster machine code.

Specifically on game programming, if you look back at the 80s and 90s, there was a lot of assembly programming going on on games and other high performance software, mainly because it was a pressing necessity. Most games used assembly code to be able to access special hardware features, like vectorization instructions such as MMX/SSE/AltiVec/etc. Today, these vectorization instructions are available as compiler intrinsics, so there is little gain in writing them using assembly.

Another issue that is driving game programmers away from assembly is portability. Not many studios can afford to release their games on a single platform these days. You need to write portable code, so assembly is only used as a last resort.

Last-gen Consoles like the PS3 still saw quite a bit of assembly programming, mainly due to its special hardware features that could not be accessed in any other way. But next-gen hardware is a lot closer to desktop PCs in architecture and performance, so again, assembly is loosing space there.

2

Of course there’s value. It just depends on whether the value is enough to offset the cost.

If you regularly program Kernel modules, device drivers or high-performance, lockless algorithms that rely on hardware-specific atomic primitives, then sometimes assembly language is your only choice. If you want those sort of programming tasks to be available to you, the cost of learning assembly might be worth it.

If you’re primarily a PHP developer making web-apps, and you’re not interested in doing anything else, you probably have little use for assembly.

Still, learning it has value, in the sense that it will help put into perspective the sort of code you write at a higher level. At the end of the day, despite all of our object-oriented, higher-order function wielding code, the programs we write ultimately compile into a stream of opcodes, mindlessly executed by a processor: load, store, load, store, cmp, jump, load, store, etc.

Learning assembly gives you perspective, and in that sense it has value. But again, whether or not the value is worth the cost of learning probably depends on what type of programmer you want to be.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật