title: Idiomatic way to do list/dict in Cython?
body: <p>My problem: I've found that processing large data sets with raw C++ using the STL map and vector can often be considerably faster (and with lower memory footprint) than using Cython.  </p>
  
  <p>I figure that part of this speed penalty is due to using Python lists and dicts, and that there might be some tricks to use less encumbered data structures in Cython. For example, this page (<a href="http://web.archive.org/web/20130824073620/http://wiki.cython.org/tutorials/numpy" rel="nofollow noreferrer">http://wiki.cython.org/tutorials/numpy</a>) shows how to make numpy arrays very fast in Cython by predefining the size and types of the ND array. </p>
  
  <p>Question: Is there any way to do something similar with lists/dicts, e.g. by stating roughly how many elements or (key,value) pairs you expect to have in them? <strong>That is, is there an idiomatic way to convert lists/dicts to (fast) data structures in Cython?</strong> </p>
  
  <p>If not I guess I'll just have to write it in C++ and wrap in a Cython import. </p>