I used the until lesson for my loop below
for (x in 0 until bodies.size) bodies[x]()
when profiling my code with MyKit, I noticed that I had a huge number of IntRange objects (about 2 fps). 
When I switch the loop to use int...int rangeTo, it does not create any garbage.
for (x in 0..bodies.size-1) bodies[x]()
Can someone explain the difference between the two? From what I can say Int.until just returns this .. to
public infix fun Int.until(to: Int): IntRange { val to_ = (to.toLong() - 1).toInt() if (to_ > to) throw IllegalArgumentException("The to argument value '$to' was too small.") return this .. to_ }
source share