4 ms·
Sometimes you genuinely know better than the compiler. Not often, but sometimes. I'm an embedded developer and recently for work I had to do inline assembly. T
by mystified5016 2y ago
Sometimes you genuinely know better than the compiler. Not often, but sometimes.
I'm an embedded developer and recently for work I had to do inline assembly. The function was there or four lines of C, two nested for loops. The runtime cost of the C is 200-300 cycles.
I rewrote the function in assembly using features particular to my CPU and brought the runtime cost to 90 cycles with no loops.
In this application, the 60% runtime reduction was worth the week it took to engineer.