Am I missing something?
I couldn't find any parallel constructs in the language. So, as I understand it, it's a regular language that gets compiled into a graph, and the runtime parallelizes the execution of that graph.
This factorial won't run any faster with more cores, since each step depends on the previous one:
fn fat(n: N64) -> N64 {
if n <= 1 {
1
} else {
n * fat(n - 1)
}
}
This other version can run in parallel, but only because the algorithm was deliberately written that way:
fn fat(n: N32) -> Nat {
if n == 0 { 1 as Nat } else { prod(1, n) }
}
fn prod(lo: N32, hi: N32) -> Nat {
if lo == hi {
lo as Nat
} else {
let m = (lo + hi) / 2;
let left = prod(lo, m);
let right = prod(m + 1, hi);
left * right
}
}
So the programmer still has to think about parallelism; the language just removes the need for threads and locks.
Also, as the graph grows, sequential dependencies still limit the speedup, and more cores means more data moving between them. How does the hardware deal with that?
I couldn't find any parallel constructs in the language. So, as I understand it, it's a regular language that gets compiled into a graph, and the runtime parallelizes the execution of that graph.
This factorial won't run any faster with more cores, since each step depends on the previous one:
This other version can run in parallel, but only because the algorithm was deliberately written that way: So the programmer still has to think about parallelism; the language just removes the need for threads and locks.Also, as the graph grows, sequential dependencies still limit the speedup, and more cores means more data moving between them. How does the hardware deal with that?