title: Ruby Hashes vs. Arrays: quickest way to find an item?
body: <p>I'm loading large TXT files into an array or hash using ruby. The input file contains more than 1'000'000 MD5 hash values, alphabetically sorted, no duplicates.</p>
  
  <p>What is the fastest way in Ruby, to find out if a certain hash value is present in my array or hash? Currently I use an array and "include?".</p>
  
  <pre><code>def loadhashlist
  @all_hash_values = Array.new
      f = File.readlines("inputmd5.txt").each do |row|
      @all_hash_values.push(row.gsub("\n",""))
      end
  end
  
  loadhashlist
  
  def hashlookup(file)
  md5 = file.getMd5
      if @all_hash_values.include? md5
      #code goes here
      end
  end
  </code></pre>