Re: [Pharo-dev] Freeze while running a loop

2015-04-04 Thread Gaurav Singh
Thanks Alain :) On Sat, Apr 4, 2015 at 5:02 PM, Alain Rastoul wrote: > Hi Gaurav, > > As said by Aliaksei, the problem is string concatenation with , > your example takes 33 secs on a core i7 3.3Ghz (quite some ms ;) ) > In Smalltalk, you handle that with streams (see Aliaksei example). > You ca

Re: [Pharo-dev] Freeze while running a loop

2015-04-04 Thread Alain Rastoul
Hi Gaurav, As said by Aliaksei, the problem is string concatenation with , your example takes 33 secs on a core i7 3.3Ghz (quite some ms ;) ) In Smalltalk, you handle that with streams (see Aliaksei example). You can also add objects to all types of collections, not only strings (Arrays etc). Yo

Re: [Pharo-dev] Freeze while running a loop

2015-04-03 Thread Jigyasa Grover
Yep , quite possible. On Fri, Apr 3, 2015 at 5:37 PM, Max Leske wrote: > > On 03 Apr 2015, at 14:05, Jigyasa Grover > wrote: > > It didn't happen with me in either of the cases :/ > Worked just fine for both. > > > May be memory / hardware dependent. > > > On Fri, Apr 3, 2015 at 5:33 PM, Gaurav

Re: [Pharo-dev] Freeze while running a loop

2015-04-03 Thread Max Leske
> On 03 Apr 2015, at 14:05, Jigyasa Grover wrote: > > It didn't happen with me in either of the cases :/ > Worked just fine for both. May be memory / hardware dependent. > > On Fri, Apr 3, 2015 at 5:33 PM, Gaurav Singh > wrote: > It doesnt happen here , but i w

Re: [Pharo-dev] Freeze while running a loop

2015-04-03 Thread Jigyasa Grover
It didn't happen with me in either of the cases :/ Worked just fine for both. On Fri, Apr 3, 2015 at 5:33 PM, Gaurav Singh wrote: > It doesnt happen here , but i was wondering why did it happen in the > string case even when the run time is just a few milliseconds ? >

Re: [Pharo-dev] Freeze while running a loop

2015-04-03 Thread Gaurav Singh
It doesnt happen here , but i was wondering why did it happen in the string case even when the run time is just a few milliseconds ?

Re: [Pharo-dev] Freeze while running a loop

2015-04-03 Thread Gaurav Singh
Thanks Aliaksei , I got it :) On Fri, Apr 3, 2015 at 5:33 PM, Gaurav Singh wrote: > It doesnt happen here , but i was wondering why did it happen in the > string case even when the run time is just a few milliseconds ? >

Re: [Pharo-dev] Freeze while running a loop

2015-04-03 Thread Aliaksei Syrel
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 f

Re: [Pharo-dev] Freeze while running a loop

2015-04-03 Thread Max Leske
> On 03 Apr 2015, at 13:43, Gaurav Singh wrote: > > My window freezes whenever i try to run a loop which has even 10 > iterations which are quite less for a computational device. > Let say i run : > [| temp | > temp := String new. > (1 to: 10) > do: [:i | temp := temp, i asString, ' ']

Re: [Pharo-dev] Freeze while running a loop

2015-04-03 Thread Jigyasa Grover
Hi Gaurav :) I tried the same code snippet, but it works fine in my system. It doesn't hang. Thanks and Regards Jigyasa Grover On Fri, Apr 3, 2015 at 5:13 PM, Gaurav Singh wrote: > My window freezes whenever i try to run a loop which has even 10 > iterations which are quite less for a comput

[Pharo-dev] Freeze while running a loop

2015-04-03 Thread Gaurav Singh
My window freezes whenever i try to run a loop which has even 10 iterations which are quite less for a computational device. Let say i run : [| temp | temp := String new. (1 to: 10) do: [:i | temp := temp, i asString, ' ']] timeToRun. The time taken to compute is a few milliseconds , but th