title: The fastest way to retrieve 16k Key-Value pairs?
body: <p><strong>OK, here's my situation :</strong></p>
  
  <ul>
  <li>I have a function -  let's say <code>U64 calc (U64 x)</code> - which takes a 64-bit integer parameter, performs some CPU-intensive operation, and returns a 64-bit value</li>
  <li>Now, given that I know ALL possible inputs (the <code>x</code>s) of that function beforehand (there are some 16000 though), I thought it might be better to pre-calculate them and then fetch them on demand (from an array-like structure).</li>
  <li>The ideal situation would be to store them all in some array <code>U64 CALC[]</code> and retrieve them by index (the <code>x</code> again)</li>
  <li>And here's the issue : I may know what the possible inputs for my calc function are, but they are most definitely <strong>NOT consecutive</strong> (e.g. not from 1 to 16000, but values that may go as low as 0 and as high as some trillions - always withing a 64-bit range)</li>
  </ul>
  
  <p><strong>E.G.</strong></p>
  
  <pre><code>  X        CALC[X]
  -----------------------
    123123   123123123
    12312    12312312
    897523   986123
  
    etc.
  </code></pre>
  
  <p><strong>And here comes my question :</strong></p>
  
  <ul>
  <li>How would you store them?</li>
  <li>What workaround would you prefer?</li>
  <li>Now, given that these values (from <code>CALC</code>) <strong>will have to be accessed some thousands-to-millions of times, per sec</strong>, which would be the best solution performance-wise?</li>
  </ul>
  
  <hr>
  
  <p><em><strong>Note</strong> : I'm no mentioning anything I've thought of or tried so as not to turn the answers into some debate of A vs B type-of-thing, and mostly not influence anyone...</em></p>