Re:Go proposal: new package to provide generic slice functions
by creata on Wednesday May 05, 2021 @11:52AM
(#27051499)
> switched to external because that was much more conducive to optimisations
Source? I thought conventional wisdom was that internal iteration was much easier for compilers to digest.
Re:Go proposal: new package to provide generic slice functions
by masklinn on Wednesday May 05, 2021 @01:05PM
(#27052574)
https://mail.mozilla.org/pipermail/rust-dev/2013-June/004364... Was probably the main starting point for that change. Though I misremembered performances being the main gist of the switch, ergonomics and flexibility were.
With https://www.reddit.com/r/rust/comments/5ez38g/rusts_iterator... as the… not counterpoint but reintroduction of internal iterators.
Linking to the Reddit thread rather that the article directly because lots of comments from important rust folks.
It is also a problem of langage design though: JS’s HoFs are spec-defined as returning Arrays, which makes fusion way more complicated.
Internal / external iteration also have different optimisation profiles e.g. Rust initially used internal iteration, switched to external because that was much more conducive to optimisations, but re-introduced an internal supplement because some combinations / patterns optimisé much better through internal iteration.