title: Get index of array element faster than O(n)
body: <p>Given I have a HUGE array, and a value from it. I want to get index of the value in array. Is there any other way, rather then call <code>Array#index</code> to get it? The problem comes from the need of keeping really huge array and calling <code>Array#index</code> enormous amount of times.</p>
  
  <p>After a couple of tries I found that <em>caching</em> indexes inside elements by storing structs with <code>(value, index)</code> fields instead of the value itself gives a huge step in performance (20x times win).</p>
  
  <p>Still I wonder if there's a more convenient way of finding index of en element without caching (or there's a good caching technique that will boost up the performance).</p>