On Mon, 1 Nov 2004 14:01:34 +0900, John Carter <john.carter / tait.co.nz> wrote: > On Mon, 1 Nov 2004, Joel VanderWerf wrote: > > > Just a little correction to a worthy post... > > thanks > > > John Carter wrote: > > ... > >> class BigExpensiveMadeOften > >> def initialize( unique_name) > >> # Big expensive computation > >> end > >> > > make that > @@memo = Hash.new {|hash,key| hash[key] = BigExpensiveMadeOften.new( key)} > > Reminder for the day for not so Nubies... > > Every reference to a string is a String.new, so sometimes factoring out string constants out of inner loops can be a big win... > Possibly you meant a string literal. A reference is what the variable ends up holding. Brian Mitchell