Hi Gaurav,

The problem is with your code. String is immutable and during concatenation it creates each time new and new String objects. In the end the length of the "temp" string is��588895. What do you think, is it efficient to create thousands of Strings with half a million length just to add a few characters at the end?

You have to use a stream to concatenate so many strings:

| stream |
stream := ReadWriteStream on: String new.
(1 to: 100000)
do: [:i | stream << (i asString, ' ')].
stream contents "returns your temp string"

Cheers,
Alex

On Fri, Apr 3, 2015 at 1:43 PM, Gaurav Singh <grvanm.coder@gmail.com> wrote:
My window freezes whenever i try to run a loop which has even 100000 iterations which are quite less for a computational device.
Let say i run :
[| temp |
temp := String new.
(1 to: 100000)
do: [:i | temp := temp, i asString, ' ']] timeToRun.
The time taken to compute is a few milliseconds , but the program freezes for quite a few seconds, What can be the problem ?