Feature request: Allocations on outlined iteration #56587
Labels
compiler:optimizer
Optimization passes (mostly in base/compiler/ssair/)
feature
Indicates new feature / enhancement requests
I've noticed that a big part of the allocations in my Julia code come from
Base.iterate
, when it doesn't inline. That might be a possible target of optimisation - at least I see no reason it couldn't stack-allocate it.Here is a small example:
These allocations appear to come from the
Union{Tuple{SubArray, Int}, Nothing}
return value ofiterate
. Interestingly, it's not that having a non-inlined function returnSubArray
itself heap allocates - if we change the code like so, it allocates the result on the stack:So, something causes the small union to heap-allocate, whereas the subarray can stack allocate.
The text was updated successfully, but these errors were encountered: