3 ms·
What language runtimes support simple data parallelism for `map`/`filter` with low syntax cost? Java lambdas do have instantiation cost but I'd wager that for
by renewiltord 7y ago
What language runtimes support simple data parallelism for `map`/`filter` with low syntax cost?
Java lambdas do have instantiation cost but I'd wager that for the majority of my code low-cost data parallelism beats that. Also, a lot of the theory here is that the JIT could kill off the instantiation and convert to just calls. Why doesn't it do that?
Rust, perhaps?
- imtringued 7y agoThe JVM can trivially inline virtual function calls and lambdas. However, it will add a sanity check that the function/lambda you're executing matches the inlined section and if not will use an indirect jump or call as a fallback.
- renewiltord 7y agoSo if I `List.of(1,2,3,4,5,6,7).stream().parallel().map(x => x * 2)` or the equivalent, that will inline a left-shift the same way it does it here? That's pretty cool.