|
|
|
|
|
by stefanha
1181 days ago
|
|
Can someone explain or share references on how HVM (or GHC or similar computational models) beat optimized compiled imperative languages like C, C++, or Rust? I took a quick look at the HVM runtime and can vaguely make out the shape of the memory and code that reduces terms. While it's cool to have a computational model that evaluates everything only once and avoids duplicating computation, if it does not compile programs to machine code to exploit hardware, then the single-core performance will be worse than C/C++/Rust. Something that generates a few machines instructions in C/C++/Rust requires reducing a graph of terms - many CPU instructions for each reduction and many memory accesses that may have poor locality. Is the idea that programs contain enough parallelism that is out of reach of human programmers so that HVM will make up for the single-core performance drag through parallelism? Maybe I'm missing what the HVM compiler does? Maybe hardware acceleration with FPGAs or ASICs could be applied? In other words, can this beautiful and elegant computational model be implemented with efficiency that matches C/C++/Rust? |
|