On 28.04.2011 10:49, Stéphane Ducasse wrote:
Henrik
you lost me
In the first example, you are making a single string with all A's of size 9000
repeated 500 times.
In the second example, you are making 9000 strings with all A's of size 10000
repeated 500 times.
Why?
My bad, I misread and thought the code was using atAllPut: , like it
should :) (that is, if its intent is to initialize a presized collection
with default values)
MessageTally spyOn:
[ 500 timesRepeat: [
| str |
str :=String new: 9000.
str atAllPut: $A ]].
only takes a couple of milliseconds.
As for nextPut: vs nextPutAll:, that is to be expected.
nextPutAll: is optimized for sizes> 1, on my machine it "catches up" when you
surpass 4 characters added in each loop.
Cheers,
Henry