Announcement
Collapse
No announcement yet.
Is foolish currently develop in machine code, hexadecimal and assembly?
Collapse
X
-
Originally posted by gens View Posti had this discussion on this very forum a long while ago
NOBODY could write a better matrix multiplication loop in C then the one i patched up in asm (and it was far from perfect)
i think one test came to ~70% of performance
But it is simply useless unless it has been proven that the loop, written in a higher level language, is a bottleneck, which is very seldom the case.
Comment
-
Assembly is fairly simple and it gives you ultimate power, but merely writing in it does not make your code any faster.
Also, inline assembly often produces worse resulting binary than what compiler can make, since compiler don't know / care about context of surrounding code.
Exception to this is gcc inline assembly syntax which is little annoying at first, but you let compiler know what is input/output and how it should handle it.
Similarly, compiler can still optimize stuff with simd intrisics (sse), but yet again, it's pain to write such code (despite advantages, such as type control).
Functions can also be written in assembly and then you can use them in C/C++/other code with ease, but you need to know about calling conventions that you are using (especially x86_64 ABI can be sometimes challenging, though nothing programmer couldn't get used to in few hours/days).
Machine code is fairly silly nowadays, same with hexadecimal (it's possible, but most people don't care about such low level stuff unless they are writing fancy stuff via shellcode such as code injections).
On my college, assembly was taught in first semester, just to give people feel about how x86/arm works).
Overall, I don't think that anyone is writing in assembly nowadays without a good reason to do so (such as performance critical code, low level system/hardware stuff).
Comment
Comment