4 ms·
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 w
by fpoling 8y ago
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++.
- pjmlp 8y agoActually NVidia's Volta was designed specifically for running C++ code. http://cppcast.com/2017/09/olivier-giroux/ http://cppcast.com/2017/09/olivier-giroux/ https://www.youtube.com/watch?v=Ud1savVLALA https://www.youtube.com/watch?v=Ud1savVLALA
- mhh__ 8y agoI 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.
- fpoling 8y agoSurely 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.