[Is...] Posted February 13, 2021 Share Posted February 13, 2021 ... Link to comment Share on other sites More sharing options...
[Is...] Posted February 14, 2021 Author Share Posted February 14, 2021 ... Link to comment Share on other sites More sharing options...
[Me...] Posted February 15, 2021 Share Posted February 15, 2021 Give this a try... executeCode("newString:= WriteStream on: String new. " + arrayVar + "do:[ :c | newString nextPutAll: c; cr]. ^newString contents.") Link to comment Share on other sites More sharing options...
[Is...] Posted February 16, 2021 Author Share Posted February 16, 2021 ... Link to comment Share on other sites More sharing options...
[He...] Posted February 23, 2021 Share Posted February 23, 2021 It's not only the loops fault for being slow but PCM is poor at handeling long strings. As TextVar1 grow with each itteration the time it takes to add another line to it also grows. In the end you have and exponential growth in the time it takes for each line. I usually solve this by creating a temporary string that loads of to the primary string at given intervals. How often depends on how long the rows are. You can play around with it by altering the denominator in the mod()-function. With this method I got it down from 11 to 3 seconds (your cumputer could use and upgrade I think). Still smalltalk is ofcourse faster but also harder for people to understand unless they know smalltalk. nP = 3600 rad=10 TimeStart=millisecondClockValue() TextVar1 ="" TextVar1temp ="" for n = 0 to nP TextVar1temp =TextVar1temp + formatR(cos(n/0.1)*rad ,0,10)+ " " + formatR(sin(n/0.1)*rad ,0,10)+ " " + formatR(0 ,0,10) + " " + formatR(cos(n/0.1) ,0,10)+ " " + formatR(sin(n/0.1),0,10)+ " " + formatR(0 ,0,10) +cr() if mod(n,50) == 0 TextVar1 = TextVar1 + TextVar1temp TextVar1temp ="" endif next n TextVar1 = TextVar1 + TextVar1temp display("Generation of points PCMLOOP: " + (millisecondClockValue() -TimeStart) + " milliSeconds") TimeStart=millisecondClockValue() code="newString:= WriteStream on: String new. 0 to: " + nP + " do:[:n|newString nextPutAll: " code= code + " ((((n/0.1) asRAD cos) * " + rad + ") asStringWithDigits: 10) , Character tab asString , " code= code + " ((((n/0.1) asRAD sin) * " + rad + ") asStringWithDigits: 10) , Character tab asString, " code= code + " '0.0000000000' , Character tab asString , " code= code + " (((n/0.1) asRAD cos ) asStringWithDigits: 10) , Character tab asString , " code= code + " (((n/0.1) asRAD sin ) asStringWithDigits: 10) , Character tab asString , " code= code + " '0.0000000000' , Character tab asString " code= code + "; cr ] . ^newString contents." TextVar2=executeCode(code) display("Generation of points WriteStream: " + (millisecondClockValue() -TimeStart) + " milliSeconds") Link to comment Share on other sites More sharing options...
[Is...] Posted February 23, 2021 Author Share Posted February 23, 2021 Please sign in to view this quote. 🤣 I’m also using similar solutions... Something funny about the performance of the computer is that most of the day I work with a low performance laptop because I don't like to hear the workstation fan .. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in