Live data from Hacker News

Ask HN: What is hand-coded assembly language used for these days?

news.ycombinator.com

31–40 of 60 posts

Re: Ask HN: What is hand-coded assembly language used for these days?

#31
post #26

Earlier quoted context omitted.

Well, you can still use C with GCC and Intel intrinsics I guess.

Intrinsics are still worse (performance-wise) than hand-coded assembly, for two reasons. The first reason is the whole category of optimizations that the compiler is worse than a human at (like register allocation) or cannot do effectively at all (messing with calling conventions, computed jumps). The second reason is more subtle: in any case that you abstract yourself from some part of a problem, you inherently crea…

I agree with your arguments, but they apply to non-vector code as well. Perhaps higher level programming using the right primitives is good enough in most cases.

Re: Ask HN: What is hand-coded assembly language used for these days?

#32
Going the other way around - can anyone think of an open source project that could benefit from some assembly optimization, and isn't? I'd love an excuse to play with this stuff in a useful fashion.

(I love what I do, but my twelve year old self would be disgusted that I'm not writing games.)

Re: Ask HN: What is hand-coded assembly language used for these days?

#33
post #22

Debugging and reverse engineering games. When publishers/developers don't give a bleep, the fans take up the task of fixing the bugs themselves. I happen to run one such project in my spare time (for C&C: Red Alert 2), and it's amazing how much stuff is broken. It's not as "serious" as other projects mentioned here, but still a reason to know ASM. (And a good way to see bad programming practices in action :) )

People are still playing C&C: RA2?!

Re: Ask HN: What is hand-coded assembly language used for these days?

#34
post #14

Earlier quoted context omitted.

A compiler can't be made to make proper use of vector instructions? Why is that?

It is an extraordinarily difficult problem to transform scalar code into vector instructions. The only way to get even passable output from a vectorizing compiler is to write the code as vectors to begin with, such as with cross-platform assembly tools like Orc. And even then you'll often end up significantly worse off than if you wrote the assembly by hand. A run of Intel's compiler on the C versions of our DSP func…

The problem is that you used C, which doesn't have any syntax to represent meta-information about the problem you're trying to solve. When you write out C code to, say, add a list of numbers, it's hard for the compiler to optimize that. But it's very easy for the compiler when you tell it "sum this list of numbers".

Re: Ask HN: What is hand-coded assembly language used for these days?

#35
post #33
post #22

Debugging and reverse engineering games. When publishers/developers don't give a bleep, the fans take up the task of fixing the bugs themselves. I happen to run one such project in my spare time (for C&C: Red Alert 2), and it's amazing how much stuff is broken. It's not as "serious" as other projects mentioned here, but still a reason to know ASM. (And a good way to see bad programming practices in action :) )

People are still playing C&C: RA2?!

Come on, people are playing all kinds of games!

I'm sure people still play Master of Magic, a strategic game from 1994. I've been playing it on and off since it came out, and I began to think - is it something wrong with me that I like this old game so much? I mean, surely there must be newer games that are better. I showed it to my teenage brother in the mid 2000's and he loved it too. I had my non-computer-gaming friends blown away by the original Heroes of Might and Magic (1995).

I think the world needs better means for preservation of old computer games.

Re: Ask HN: What is hand-coded assembly language used for these days?

#37
Microcontroller firmware. There are many examples of AVR code in assembly on the web. I learned assembly this way. It really makes sense when you're working on bare hardware with no abstraction layers in the way. Also, it's useful for time-critical applications such as creating video signals or audio processing.

Re: Ask HN: What is hand-coded assembly language used for these days?

#39
post #7

I did some assembly optimization for an internal RTL-level simulator. We had ~1000 machines on a three year upgrade cycle, i.e., we upgraded 333 machines / year = $333k / year. Lets say I cost the company $200k / year. Several days = perhaps $2k, so I'd only need to get a .6% speedup for it to be worth it, not even including the cost of powering and maintaining our machines. When I worked on it, our simulator was an…

Thanks! Especially for the numbers. I had not even heard of RTL simulation before. Wow, extremely cool.

Re: Ask HN: What is hand-coded assembly language used for these days?

#40
post #27
post #20

Earlier quoted context omitted.

Having read and written assembly on a daily basis for years, I have to disagree entirely. The only simple thing about assembly is that it happens to map to machine code directly, but macros and quasi-instructions even make that iffy. There are so many idiosyncrasies in every ISA, so many ways in which the code you write has side effects. Assembly isn't just complex in practice, it's complex in concept. If you want si…

Try ARM. x86 assembly is ugly and wart ridden. ARM is like a breath of fresh air. Unbelievably well designed.

Testify!

15 years ago, I did Intel-style assembly--and loved it even with all its clumsiness. But I just dove into ARM a few weeks ago, and am loving it even more. Such sweet pleasure to code so close to such a beautiful and simple machine!

Post reply on HN