5 ms·
C's simplicity leads to fewer guarantees, this makes some optimizations impossible. E.g. Fortran used to be faster than C in numerical code, because the guarant
by nine_k 8y ago
C's simplicity leads to fewer guarantees, this makes some optimizations impossible. E.g. Fortran used to be faster than C in numerical code, because the guarantee of no aliasing allows for more aggressive optimizations.
Maybe Zig has something in this department, too.
- AndyKelley 8y agoCross posting from https://www.reddit.com/r/programming/comments/bjwhm5/introduction_the_zig_programming_language/emc30to/ https://www.reddit.com/r/programming/comments/bjwhm5/introdu... Parameters can have `noalias` on them. This is [currently undocumented](https://github.com/ziglang/zig/issues/1521 https://github.com/ziglang/zig/issues/1521) and [not yet safety checked](https://github.com/ziglang/zig/issues/476 https://github.com/ziglang/zig/issues/476) and there is an [open area of research considering doing it the opposite way](https://github.com/ziglang/zig/issues/1108 https://github.com/ziglang/zig/issues/1108). Provided that it could be safety-checked, opt-in aliasing has the potential to make Zig even faster. As far as I'm aware, this is currently the only way in which Rust could potentially outperform Zig (and C).
- flukus 8y ago> C's simplicity leads to fewer guarantees, this makes some optimizations impossible. I know that's the theory, but with few exceptions this doesn't seem to have panned out in reality anywhere and C is usually still the gold standard when it come to performance. How many more decades until we get these sufficiently smart compilers?