3 ms·
In a previous job, I once tried to rewrite those small - tiny, really! - functions that were called all over the place in assembly, so I kind of looked at it fr
by krylon 8y ago
In a previous job, I once tried to rewrite those small - tiny, really! - functions that were called all over the place in assembly, so I kind of looked at it from the opposite direction.
The experience was both frustrating and elating. In the end, the "optimized" assembly code I could come up with was pretty much identical to the code generated by the compiler. So I missed that rush of showing the compiler who's boss. This is what led me to abandon the project very quickly.
On the other hand, I was very relieved that my hand-written code was at least not worse than what the compiler could come up with. So at least I could get out with my dignity intact.
To be fair, those small functions were so small and simple (no more than three or four instructions) that there really was only one obvious way to implement them in x86 assembly. So maybe my problem set was a bad choice. It was fun, though.
- eesmith 8y agoNo more than three or four instructions? See also https://en.wikipedia.org/wiki/Superoptimization https://en.wikipedia.org/wiki/Superoptimization .