Re:Some obscure C features
by jstimpfle on Friday January 26, 2018 @02:45AM
(#16237593)
The C machine model is still the only model I can easily program and not make a mess. And without being a hardware architecture expert: Has so much changed on the assembly level? And what other languages are truer to today's machines?
[ Parent
| on HN ]
None of them are, not even Assembly, unless the CPU executes the opcodes directly in hardware without micro-code help.
The C machine model says nothing about vector instructions, instruction re-ordering, NUMA, GPGPU, IO ports, Harvard architecture, multi-core.
As of C11, the C machine model does (finally) include threads and memory ordering, so at least you can say it says something about multi-core…
Re:Some obscure C features
by red75prime on Friday January 26, 2018 @05:31AM
(#16238181)
Modern C compilers do enormous job of optimizing C code, despite its shortcomings like the lack of distinction between pointers and arrays. You don't need to worry too much about that, maybe you'll need to sprinkle vectorization intrinsics or assembler code if the compiler isn't smart enough, or to add a couple of memory barriers.
Would mostly sign that, but not without inspecting security or performance critical code in disassembler.
Modern compilers are still rather bad at vectorization. What's worse, those optimizations are often unstable. A small change might make code several times slower. Performance regression tests and when that fails, vector intrinsics are a must.