I don't know what platforms or compilers you're working on, but on x86 and arm the compilers are great. We (I work someplace you've heard of doing graphics and multimedia) have literally no assembly code. There is no reason why a good optimizing compiler can't generate fast asm, and often it thinks of optimizations that even our best engineers may miss.
You should try racing the compiler sometime on something more complex than a line or two of code. It will most likely win.
Also keep in mind that inserting asm throws off a ton of optimizations because the compiler can't guarantee you're following the c/c++ standards in your asm.
I also have worked in someplace you've heard doing multimedia, and I can assure you FFmpeg's assembly code is way faster than the C version, that's the whole reason why they have assembly code.
Do you want me to compile both and show you how wrong you are?
You can never trust the compiler to generate the most optimal code, and the generated code can never be as optimal as what an expert engineer would write.
I guess you don't want me to compare the performance of C-only FFmpeg vs. C+ASM FFmpeg. Right?
2
u/[deleted] Oct 05 '13
I don't know what platforms or compilers you're working on, but on x86 and arm the compilers are great. We (I work someplace you've heard of doing graphics and multimedia) have literally no assembly code. There is no reason why a good optimizing compiler can't generate fast asm, and often it thinks of optimizations that even our best engineers may miss.
You should try racing the compiler sometime on something more complex than a line or two of code. It will most likely win.
Also keep in mind that inserting asm throws off a ton of optimizations because the compiler can't guarantee you're following the c/c++ standards in your asm.
Edit: accidentally submitted to early.