From: David Garamond Date: 2004-12-28T22:49:13+09:00 Subject: Re: help on making ruby code faster Robert Klemme wrote: >>Can't Ruby currently optimize those? I frankly don't want to have to do >>those kinds of optimization myself :-( > > It does (by sharing the internal string buffer) but it still has to create > new String instances on each run: > >>>5.times { p 's'.id } > > 134947060 > 134946988 > 134696172 > 134690592 > 134690544 > => 5 > > If it would not do this, code like this would yield unexpected results: > >>>5.times { p 'abc'[1] += 1 } I see. Suddenly I want immutable strings like in Python. Hm, it seems optimizing Ruby programs is pretty tedious? One has to scorch through every string literal... Regards, dave