I see a difference in the outputs of @code_typed (e.g., foo1 calls invoke Base.Broadcast.var and Core._apply_iterate ,foo2 does not) but I’m not sure how to interpret them.
Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread. (Original message )(More Info)
likely hitting some compiler heuristic threshold for Broadcast.flatten, which is how StaticArrays implements broadcasting. […] Broadcast.flatten is an alternative way to implement broadcasting. It creates lots of anonymous functions. If they don’t inline, you’ll see them as var"5#6" s and the like [in @code_typed].