Not in C. What looks like the same field access at language level could become an L1 cache access or a main memory access taking 3 orders or magnitude longer.
Cache line aliasing is part of the hardware-level operation.
Exactly, so a good low-level language would make it visible.
That I can reorder the fields of a struct to achieve massive improvements in performance is exactly the sort of control I want in a low-level language.
Exactly. A low-level language would let you control it. C reduces you to permuting the fields and guessing.
The nearest of what you describe is the Cell; it has been tried and it was basically a failure.
There is a reason current high perf compute is not programmed like that, and the designers are not stupids. Cache hierarchy managed by the hardware is actually one of the most crucial piece of what lets modern computers be fast.
What you're saying is that there's no use case for a low level language any more. Which is fine, but if we're going to use a high level language either way then there are better choices than C.
"Control over memory" in what sense? Standard C doesn't give you full control over memory layout (struct padding can only be controlled with vendor extensions) or use (since modern OSes tend to use overcommit and CoW).
9
u/m50d Aug 13 '18
Not in C. What looks like the same field access at language level could become an L1 cache access or a main memory access taking 3 orders or magnitude longer.
Exactly, so a good low-level language would make it visible.
Exactly. A low-level language would let you control it. C reduces you to permuting the fields and guessing.