I strongly agree with this statement. I was personally even more surprised by https://github.com/tkf/Restacker.jl/blob/master/benchmark/bench_unique.jl where the restack
on the return variable allows us to ellide an allocation in the loop (probably because it is no longer escaping the function).
Personally I want to see every case where restack
works analyzed and understood so that the Julia compiler gets better and we don’t need “magic” compiler annotations. I have the same feeling about @avx
and @simd
(the latter is useful due to the semantics of reductions). I am happy to attempt to triage these things and at least give an educated guess on examples where this helps.
13 Likes