numpy/numpy — pull request #3410 by m-d-w (2013-06-06 19:34:24+00:00)
Title: ENH: Optimize array creation by avoiding errors

This code optimizes numpy.array() when argument contains either list of lists or lists containing None.
These were problematic because exceptions are created and ignored causing significant (40x) overhead.

This optimization works by providing a 'lite' version of PyObject_GetAttrString which avoids creating exceptions
by special casing list, tuple and None types. Buffer operations are gated by PyObject_CheckBuffer.

Discused on stack overflow: http://stackoverflow.com/questions/16819261/why-is-numpy-array-is-sometimes-very-slow

#3396 - original version of this PR

#2938 - similar PR