Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Believe me, there are a lot of cases where a human beats the compiler.

Oh, I do believe you. I do analyze and re-write assembly code from the C compiler every now and then. SIMD optimizations are especially tricky. But the compiler still wins at least 80% of the cases.

And when you add a single line of assembly code (inline or not) to your C code, you inhibit all optimizations that could take place.

So for your innermost loop it might make sense to hand write assembly, but for most optimizations just re-think your C code and/or add compiler intrinsics to get SIMD or other CPU facilities put to better use.



> when you add a single line of assembly code (inline or not) to your C code, you inhibit all optimizations that could take place.

That's a significant exaggeration with most compilers. You may inhibit some optimization which would require the compiler be able to reason about side-effects across the asm block, but that's a far cry from "all optimizations".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: