Re: [Pharo-users] When to use a stream for concatenating text..

2015-03-13 Thread Sven Van Caekenberghe
The breaking point seems to be around 5 concatenations: str:= Character alphabet. [ str, str, str, str, str ] bench. "'1,020,043 per second'" [ String new: str size * 5 streamContents: [ :out | 5 timesRepeat: [ out nextPutAll: str ] ] ] bench. "'949,738 per second'" > On 13 Mar 2015, at

Re: [Pharo-users] When to use a stream for concatenating text..

2015-03-13 Thread Marcus Denker
> On 13 Mar 2015, at 08:41, stepharo wrote: > > use > > String streamContents: [:s | >s nextPutAll: 'jlklkjkl' ] > > > or > > String streamContents: [:s | >s << 'jlklkjkl' ] > > > it is a great method for manipulating > > Le 10/3/15 19:09, sergio_101 a écrit : >> >> it seems that

Re: [Pharo-users] When to use a stream for concatenating text..

2015-03-13 Thread stepharo
use String streamContents: [:s | s nextPutAll: 'jlklkjkl' ] or String streamContents: [:s | s << 'jlklkjkl' ] it is a great method for manipulating Le 10/3/15 19:09, sergio_101 a écrit : it seems that in more cases than not, i find that developers use a stream when concatenating

[Pharo-users] When to use a stream for concatenating text..

2015-03-12 Thread sergio_101
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. Thanks!

Re: [Pharo-users] When to use a stream for concatenating text..

2015-03-10 Thread Esteban A. Maringolo
Andres Valloud performed some benchmarking in the past and his conclusion was that there was a threshold higher than expected when the streamed concatenation was faster and memory savvier. This was years ago, and of course I don't remember such threshold. However from the code aesthetics I use sim

Re: [Pharo-users] When to use a stream for concatenating text..

2015-03-10 Thread Ben Coman
There are a few things floating around the web saying that it is faster using a stream for concatenation, but its been shown a while back to be "not necessarily" true. It depends on the use case so you should profile - if its that important. cheers -ben On Wed, Mar 11, 2015 at 2:09 AM, sergio_101

Re: [Pharo-users] When to use a stream for concatenating text..

2015-03-10 Thread sergio_101
gotcha.. this makes sense. On Tue, Mar 10, 2015 at 2:18 PM Esteban A. Maringolo wrote: > 2015-03-10 15:09 GMT-03:00 sergio_101 : > > > > 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 smallta

Re: [Pharo-users] When to use a stream for concatenating text..

2015-03-10 Thread Esteban A. Maringolo
2015-03-10 15:09 GMT-03:00 sergio_101 : > > 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 sp