From: Steve Wilhelm Date: 2009-12-09T05:11:53+09:00 Subject: Re: convert string into a variable object David Masover wrote: > On Tuesday 08 December 2009 01:03:31 am Steve Wilhelm wrote: >> > @hash[x] = true >> > end >> >> Would it not be better to convert to symbols? > > Not if the cities are changing every day. Remember, symbols are never > garbage > collected -- they should _only_ be used when there is a finite and > predictable I would have thought number of cities over time would be finite and predictable. Granted, the number of cities is probably in the tend or hundreds of thousands. So symbols would be appropriate if instead of cities, adad was reading a text file of state names? How about country names (currently under 200)? I ask, in an attempt to gauge what is typically considered the accepted threshold for using symbols. > number of possible symbols you might create. > > Otherwise, you have a slow memory leak -- and especially for something > like > this, you're not really going to get a performance boost out of it. -- Posted via http://www.ruby-forum.com/.