Re:FFmpeg School of Assembly Language
by jki275 on Saturday February 22, 2025 @01:03PM
(#43141406)
Probably some very niche things. I know I can't write ASM that's 10x better than C, but I wouldn't assume no one can.
[ Parent
| on HN ]
Re:FFmpeg School of Assembly Language
by CyberDildonics on Saturday February 22, 2025 @03:32PM
(#43142915)
It isn't very hard to write C that is 10x better than C, because most programs have too many memory allocations and terrible memory access patterns. Once you sort that out you are already more than 10x ahead, then you can turn on the juice with SIMD, parallelization and possibly optimize for memory bandwidth as well.
Re:FFmpeg School of Assembly Language
by 1propionyl on Saturday February 22, 2025 @01:09PM
(#43141456)
It depends on what you're trying to do. I would in general only expect such substantial speedups when considering writing computation kernels (for audio, video, etc).
Compilers today are liable in most circumstances to know many more tricks than you do. Especially if you make use of hints (e.g. "this memory is almost always accessed sequentially", "this branch is almost never taken", etc) to guide it.
Oh I definitely agree that in the vast majority of cases the compiler will probably win.
But I suspect there are cases where the super experts exist who can do things better.
Re:FFmpeg School of Assembly Language
by astrange on Saturday February 22, 2025 @07:03PM
(#43144660)
Mm, those hints don't matter on modern CPUs. There's no good way for the compiler to pass it down to them either. There are some things like prefetch instructions, but unless you know the exact machine you're targeting, you won't know when to use them.