gotcha.. this makes sense.
On Tue, Mar 10, 2015 at 2:18 PM Esteban A. Maringolo <
emaringolo@gmail.com> wrote:
2015-03-10 15:09 GMT-03:00 sergio_101 <sergio.rrd@gmail.com>:
>
> it seems that in more cases than not, i find that developers use a stream
> when concatenating some text strings.
>
> I am wondering if this is a smalltalk thing, or is there a real speed
> benefit when using streams in this way.
It is not a matter of speed only, but mostly memory.
For large text concatenations Streams are more memory efficient
because you don't create intermediate strings.
E.g.
'string1', 'string2', 'string3' ... , "stringN" will require the
creation of N intermediate String instances.
aStream
�� nextPutAll: 'string1';
�� nextPutAll: 'string2';
�� nextPutAll: 'string3';
�� nextPutAll: 'stringN'
Will only add contents to the Stream collection.
Esteban A. Maringolo