title: Getting past slow list creation in python
body: <p>Good evening!</p>
  
  <p>I was running some tests on lists and list creation vs iterator creation and I came across some staggering time differences. Observe the following:</p>
  
  <pre><code>&gt;&gt;&gt; timeit.timeit('map(lambda x: x**3, [1, 2, 3, 4, 5])')
  0.4515998857965542
  &gt;&gt;&gt; timeit.timeit('list(map(lambda x: x**3, [1, 2, 3, 4, 5]))')
  2.868906182460819
  </code></pre>
  
  <p>The iterator version returned by the first test runs more than 6x as fast as converting to a list. I understand basically why this might be occurring, but what I'm more interested in is a solution. Does anyone know of a data structure similar to a list that offers fast creation time? (Basically, I want to know if there is a way to go straight from iterator (i.e. <code>map</code> or <code>filter</code> function, etc.), to a list without any major performance hits)</p>
  
  <p>Things I can sacrifice for speed:</p>
  
  <ol>
  <li><p>Appending, inserting, popping and deleting elements.</p></li>
  <li><p>Slicing of elements.</p></li>
  <li><p>Reversing the list or any inplace operators like sort.</p></li>
  <li><p>Contains (<code>in</code>) operator.</p></li>
  <li><p>Concatenation and multiplication.</p></li>
  </ol>
  
  <p>All suggestions are welcome thanks!</p>
  
  <p>EDIT: Indeed this is for python 3.</p>