title: Why is numpy.array so slow?
body: <p>I am baffled by this</p>
  
  <pre><code>def main():
      for i in xrange(2560000):
          a = [0.0, 0.0, 0.0]
  
  main()
  
  $ time python test.py
  
  real     0m0.793s
  </code></pre>
  
  <p>Let's now see with numpy:</p>
  
  <pre><code>import numpy
  
  def main():
      for i in xrange(2560000):
          a = numpy.array([0.0, 0.0, 0.0])
  
  main()
  
  $ time python test.py
  
  real    0m39.338s
  </code></pre>
  
  <p>Holy CPU cycles batman! </p>
  
  <p>Using <code>numpy.zeros(3)</code> improves, but still not enough IMHO</p>
  
  <pre><code>$ time python test.py
  
  real    0m5.610s
  user    0m5.449s
  sys 0m0.070s
  </code></pre>
  
  <p>numpy.version.version = '1.5.1'</p>
  
  <p>If you are wondering if the list creation is skipped for optimization in the first example, it is not:</p>
  
  <pre><code>  5          19 LOAD_CONST               2 (0.0)
               22 LOAD_CONST               2 (0.0)
               25 LOAD_CONST               2 (0.0)
               28 BUILD_LIST               3
               31 STORE_FAST               1 (a)
  </code></pre>