Yes. �And besides having to collect the garbage at some point, allocation can be costly because the VM has to zero out the string bytes (or nil them if the string is not encoded) and then write on those zeroed (nilled) places with something else. �It takes time.We�re only measuring execution speed, not memory allocation, which is important too.
The order also matters, e.g.
The length of the strings is a variable as well, of course.
� � � � (String new: 7812681237643287423), 'a', 'b', 'c'
and the way you aggregate the result matters as well.Yes, it's much more complex than it seems when the inefficiency of naive concatenation methods is not flagrant.
Conclusion, let�s be careful with a too simple advice.
Andres.