[review] Easy win to improve numpy import times by 30 %
Hi, This branch improves numpy import times quite significantly on slow machines: http://github.com/cournape/numpy/tree/noinspect One of the main culprit is ma, because of inspect (inspect is extremely slow to import; as a data point, python -c "import inspect" takes 67 ms vs python -c "" taking 22 ms, and python -c "import numpy" taking 158 ms on my machine). Since inspect is used in quite a few places, and that we only use it to extract arguments from a function, I added a small numpy.lib.inspect module, and change the import in numpy.ma. I copied the inspect module of python 2.4.4 to ensure maximum compatibility. This speed up the import times from 158 ms to 108 ms ~ 30 % speed improvement. On recent machines, the speedup is less impressive, but still in the 20 % range. I think it largely worths it, and will integrate this unless someone is strongly against it or see a problem with the approach, cheers, David
David Cournapeau wrote:
This branch improves numpy import times quite significantly on slow machines:
I think it largely worths it, and will integrate this unless someone is strongly against it or see a problem with the approach,
+1 -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov
On Fri, Oct 9, 2009 at 5:56 AM, David Cournapeau
Since inspect is used in quite a few places, and that we only use it to extract arguments from a function, I added a small numpy.lib.inspect module, and ...
Is numpy.lib intended as a public API? How about numpy.lib._inspect instead of numpy.lib.inspect to make it clear this new module is private? Peter
participants (3)
-
Chris Barker
-
David Cournapeau
-
Peter