From: Joseph McDonald Date: 2001-08-16T02:40:36+09:00 Subject: [ruby-talk:19810] Re: how to speed up hash script? GW> # Store line indices in dictionary based on date field GW> @dict = Hash.new() GW> for i in 1...@num_lines GW> @dict[@lines[i][0...@len_date]] = i GW> end Ruby hashes seem to be much faster if you use a number as a key instead of a string. So maybe: for i in 1...@num_lines @dict[@lines[i][0...@len_date].to_i] = i end -joe