From: Brian Candler Date: 2003-05-12T20:38:18+09:00 Subject: Re: efficiency advice needed On Mon, May 12, 2003 at 06:40:06PM +0900, Robert Klemme wrote: > > > If you want to append to a string, using "<<" or "concat" is better > than > > > "+=" since "+=" creates a new instance every time. You can verify it > like > > > this: And even better is to preallocate the source string: i.e. space = " " ... do a << space * n end is faster than a << " " * n because the latter generates a new string object (containing one space) each time round the loop. Cheers, Brian.