From: Hee-Sob Park Date: 2000-12-16T12:40:01+09:00 Subject: [ruby-talk:7384] Re: Ruby performance question Hi, "David Alan Black" wrote in message news:Pine.LNX.4.21.0012152059560.23782-100000@candle.superlink.net... > On Sat, 16 Dec 2000, Joseph McDonald wrote: > > > I found that a combination of your technique with Dave's technique > > to be the fastest: > > > > def dt_readfile > > h = Hash.new > > file = File.new("keys") > > while line = file.gets > > record = line.chomp!.tr!('=', ',').split(',') > > h[record.shift] = record.shift until record.empty? > > # do stuff here... > > h.clear > > end > > end > > I found even another fastest version: def dt_readfile h = Hash.new file = File.new("keys") while line = file.gets record = line.chomp!.tr!('=', ',').split(',') h = Hash.new(record) # do stuff here... h.clear end end > David Alan Black Park, Hee-Sob