News for hackers. Stuff that matters.
Re:Why is this C++ code faster than my hand-written assembly... by ktRolster on Tuesday August 22, 2017 @03:33PM (#15075648)
You are right. A lot of times you can rearrange the code in various ways, and the compiler will happily generate more efficient code.

When that's not possible, the way to keep it portable is by writing a generic C function, then writing an optimized version of the same function that will be compiled when that architecture is available.

At work it's rare to need to compile the same code for various architectures, but sometimes it happens.

There are no comments on this comment yet.