From: "Iñaki Baz Castillo" Date: 2009-03-30T19:01:55+09:00 Subject: Re: Symbols garbage collector in Ruby1.9, fixed? 2009/3/30 Bill Kelly : >> Thanks but it is too slow: >> >> Benchmark.realtime{ Symbol.all_symbols.map {|s| s.to_s}.include? "qwe" } >> => 0.00371980667114258 >> >> I cannot do this test for each header in each received message. > > I assumed you had a plan for that.  :) > > We could cache them as a hash, for rapid lookup: > >  @known_symbols = Hash[ *Symbol.all_symbols.map {|s| [s.to_s,true]}.flatten > ] > > # Later.... > >  @known_symbols.include? "xyzzy" That sounds interesting, I'll try it. Thanks :) -- Iñaki Baz Castillo