Address type-unstable hot loops. Things worth trying, or order of invasiveness:
- Introduce a function barrier. Replace
for d in devices # typeof(d) varies: loop body is type unstable.
# code here won't specialize.
end
with
for d in devices
_inner!(container, d, ...)
end
function _inner!(contrainer, d::D, ...) where {D}
# compiled per concrete D: code here will specialize
# (still a runtime dispatch, though)
end
If the loop body is sufficiently complex, and devices contains a couple different concrete types, the 2nd should win out. This may increase compile-time, though, so it's worth measuring.
- Add a replacement for
FlattenedIterator that unrolls across the different types. See IS #505. Requires interface work in IS (prototyped in that PR) plus rewriting the loops to use map and similar.
Address type-unstable hot loops. Things worth trying, or order of invasiveness:
with
If the loop body is sufficiently complex, and
devicescontains a couple different concrete types, the 2nd should win out. This may increase compile-time, though, so it's worth measuring.FlattenedIteratorthat unrolls across the different types. See IS #505. Requires interface work in IS (prototyped in that PR) plus rewriting the loops to usemapand similar.