News for hackers. Stuff that matters.
Re:Pointers Are More Abstract Than You Might Expect in C by fpoling on Monday July 02, 2018 @12:30PM (#17443060)
To get the max performance on modern CPU the code has to be cache-aware. It is painful to program for that in C. One often ends up with very complex macros or writing code generators that writes CPU-specific C code. So modern ISA are not designed for C.

By such arguments one can claim that CPU are designed for Fortran as it's compilers allows to write fast code with less efforts than in C/C++.

Re:Pointers Are More Abstract Than You Might Expect in C by pjmlp on Monday July 02, 2018 @01:45PM (#17443809)
Actually NVidia's Volta was designed specifically for running C++ code.

http://cppcast.com/2017/09/olivier-giroux/

https://www.youtube.com/watch?v=Ud1savVLALA

Re:Pointers Are More Abstract Than You Might Expect in C by mhh__ on Monday July 02, 2018 @04:31PM (#17445075)
I think it is fair to say that modern ISA are built around a C-speaking world if that's more reasonable.

This may also be especially true - on a technicality: Does the ISA actually specify the exact cache structure of a CPU? If not, then it is definitely reasonable to say that the ISA (if not the whole microarchitecture?) then is designed with C in mind.

Re:Pointers Are More Abstract Than You Might Expect in C by fpoling on Monday July 02, 2018 @05:30PM (#17445479)
Surely nobody designs ISA that performs badly for C programs. But it does not mean that it was designed to run average C programs optimally.

If one searches for "data oriented programming", then a typical link is about game programming and how using struct of arrays instead of array of structs improves performance due to better cache locality. But such struct of arrays are hard to use and maintain in a general purpose code. It works ok only in game engines or in numerical code when one have a lot of things with the same attribute and the total number of different attributes is low. So if anything, ISA is tailored to allow max performance when coding games or numerical recepeices in particular style. That style is not feasible to apply, for example, in kernel as C has very poor support for it and one gets too many different attributes to get real benefits from following such style.