Description
I was working on updating JuliennedArrays for 0.7 and I had some thoughts. Once we're over the 1.0 hill, it might be worth considering the (mostly, I think?) non-breaking infrastructure improvements that could lead to a fast mapslices.
-
There's been a ton of great work on constant propagation, but I think we still need Constant propogation through slurping #26050?
-
We need a cutoff to distinguish "large" tuples from "small tuples". It's usually faster to iterate over large tuples and unroll over small tuples. I think Tim Holy had a PR for this.
-
Type stable boolean indexing on small tuples with mixed type, e.g.
(1, 2.0, "three")[(true, false, true])
. This is only one of many operations that could become type-stable by unrolling small tuples (other examples include reduce, find, flatten, product, filter). This could all be done with lispy tuple iteration. If I understand correctly, creating a unified interface could unify lispy tuple iteration that is scattered across Base. -
Formalized reduction functions. This would look something like
struct Reduce{F}
f::F
end
(r::Reduce)(x) = reduce(r.f, x)
const sum = Reduce(+)
etc. Knowing whether some function is an reduction of another function would enable some crucial optimizations; compare the performance of mapslices
and mapreducedims
.
None of this is critical but none of it is too breaking (I don't think). Just worth thinking about.