3 ms·
This isn't true at all, in fact, the opposite is true. Compilers are often better than naive micro optimizations, but they do not always have every optimization
by benchaney 10y ago
This isn't true at all, in fact, the opposite is true. Compilers are often better than naive micro optimizations, but they do not always have every optimization programmed for every architecture. An expert can absolutely beat the compiler in some cases.
- Veedrac 10y agoAlthough I agree the compiler rarely produces great code automatically, it's normally possible to handhold the compiler into producing code roughly equivalent to hand-written ASM. Doing so is rarely easier, but it is at least more portable!
- benchaney 10y agoCompilers don't use all instructions. For example crypto code often require assembly in order to take advantage of AES instructions.
- Veedrac 10y agoThat's what intrinsics are for.
- user5994461 10y agoGiven the comments, I would assume that the other commenters don't know about intrinsics, or embedding ASM code into C, or "handholding the compiler into producing great code".