First of all, welcome to our community! ![]()
Second, because the code will be inherently type unstable? The most relevant performance tip is probably: Performance Tips · The Julia Language
If you gonna go this way (what is really kinda strange to me for real code), probably the best you can do is to apply the same function (that does the same as the body of the loop) to each element separately.