2 ms·
Competing with C is a pretty low bar, nowadays; although I appreciate the uniquely careful definition used here. When you are serious about performance, nowada
by ncmncm 9y ago
Competing with C is a pretty low bar, nowadays; although I appreciate the uniquely careful definition used here.
When you are serious about performance, nowadays, cache misses and branch prediction are decreasingly relevant. You need to talk about drawing on computational resources practically inaccessible from C, including AVXn vector units, and shaders.
C's weakness for expressing abstractions is a fundamental and unbridgeable handicap for such computation. C++ might be up to the job, and Haskell should be. It is not clear whether Rust is. For this kind of hardware exploitation, direct compiler support will always lag far behind. You need for the language to be expressive enough to support writing libraries that wrap access to the platform's hardware features in a way that the library can be ported to other hardware without changing client code, and present its capabilities in a way natural for the language.
Compiler optimizers are good at merging client code with library implementation when both are in the same language, and can identify efficiencies not available to library or clients taken in isolation.
It is not typically less work to write such a library than to tailor a compiler, but the work has better longevity. Other people port the library for their hardware, and all the compilers and programs are brought along.
In the case of rustc and ghc, where there is momentarily only one compiler, it may be harder to see this.