3 ms·
The performance increases from using C these days really come from it forcing you to avoid abstraction rather than access to the hardware. If you imagine the am
by mhh__ 6y ago
The performance increases from using C these days really come from it forcing you to avoid abstraction rather than access to the hardware. If you imagine the amount of indirection a Python program has just to add two numbers, that's why C is "fast". Compilers are clever, but they generally don't bother and aren't really allowed to look too far away from a given expression or function i.e. Extracting very high level information about even integers still requires manual annotation - GCC and LLVM will happily propagate parity through an expression but declaring an invariant about an integer inside a struct is not possible even with extensions AFAICS
The issue we have, now, however isn't that your code (or any code, ideally) is slow but that the depth of the tree from your library call down to the missile launching is too deep. There's just too much crap in between the important stuff.
- eru 6y agoIn principle, a higher level language like eg some variant of Haskell, would give compiler much more freedom to optimize. Including making collapsing what remains at runtime of the path between what your code describes and the missile launching. In practice, we aren't quite there yet.