Re:Go proposal: new package to provide generic slice functions
by pjmlp on Wednesday May 05, 2021 @02:10PM
(#27053512)
I remember the days when functional languages wasn't a synonym for like Haskell does it.
Speaking of which just use OCaml bytecode backend or Haskell interpreter to see how slow complex languages are.
This is what is missing to Rust and cranelift might help to deliver, alongside not having to keep compiling the whole world from scratch.
Re:Go proposal: new package to provide generic slice functions
by 8fGTBjZxBcHq on Wednesday May 05, 2021 @06:53PM
(#27056850)
I don't know about JS's particular challenges here and I believe you but a lot of languages with a lot of other features also do this optimization. It's not just the hardcore functional ones though admittedly maybe mostly in the ones most influenced by them.
The large amount of IR given to LLVM is closely related to the amount of abstractions that Rust uses. It's especially relevant for iterators where a "simple" `for` loop expands to `into_iter()`, `iter.next()`, `match`, `drop`, and arithmetic expands to calls to overloadable operator methods, all moves are `memcpy` to clean up, and so on.
https://rust.godbolt.org/z/71aEnf9Ta