title: efficient way to hold and process a big dict in memory in python
body: <p>As I did a bit test, a python dict of int=>int (different value) of 30 million items can easily eats >2G memory on my mac. Since I work with only int to int dict, is there any better solution than using python dict? </p>
  
  <p>Some requirements I need are,</p>
  
  <ol>
  <li>more memory efficient at holding tens of million level of int to int items</li>
  <li>basic dict methods like fetching value by key and iterating all items</li>
  <li>easy to serialise to string / binary would be a plus</li>
  </ol>
  
  <p>Update,
   4. easy to get subset by given keys, like d.fromkeys([...])</p>
  
  <p>Thanks.</p>