3 ms·
>The saying that "processors are optimizing for C" is totally correct. I thought that the latest consensus on HN was that C is nowhere closer to the hardware.
by arm64future 6y ago
>The saying that "processors are optimizing for C" is totally correct.
I thought that the latest consensus on HN was that C is nowhere closer to the hardware.
- AnimalMuppet 6y agoTwo things are both true. 1. Processors no longer look all that much like C's idea of what a processor is. 2. Processors are optimized to be able to execute C code very well. But an optimizing compiler can make it much better. There's a fair amount of magic in compilers to make this work.
- comex 6y agoC is close to the interface the hardware presents you – that is, the instruction set – but far from what the hardware actually does. Caching, out-of-order execution, branch prediction, speculation... all of those things are just as opaque to assembly as they are to C.
- msla 6y ago> C is close to the interface the hardware presents you – that is, the instruction set – but far from what the hardware actually does. C isn't even close to that anymore, now that so many processors have SIMD ISAs which C can't usefully model.
- pjmlp 6y agoAny good optimizing compiler is able to achieve this, there is nothing special about C in it.