<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 1, 2014 at 11:23 PM, Charles R Harris <span dir="ltr"><<a href="mailto:charlesr.harris@gmail.com" target="_blank">charlesr.harris@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="">On Fri, Aug 1, 2014 at 7:59 AM, Robert Kern <span dir="ltr"><<a href="mailto:robert.kern@gmail.com" target="_blank">robert.kern@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Fri, Aug 1, 2014 at 2:54 PM, Charles R Harris<br>
<<a href="mailto:charlesr.harris@gmail.com" target="_blank">charlesr.harris@gmail.com</a>> wrote:<br>
<br>
> Importing inspect looks to take about  500 ns on my machine. Although It is<br>
> hard to be exact, as I suspect the file is sitting in the file cache. Would<br>
> probably be slower with hard disks.<br>
<br>
</div>Or where site-packages is on NFS.<br>
<div><br>
> But as the inspect module is already<br>
> imported elsewhere, the python interpreter should also have it cached.<br>
<br>
</div>Not on a normal import it's not.<br>
<br>
>>> import numpy<br>
>>> import sys<br>
>>> sys.modules['inspect']<br>
Traceback (most recent call last):<br>
  File "<stdin>", line 1, in <module><br>
KeyError: 'inspect'<br></blockquote><div><br></div></div><div>There are two lazy imports of inspect.<br> <br></div><div class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
You should feel free to remove whatever parts of `_inspect` are not<br>
being used and to move the parts that are closer to where they are<br>
used if you feel compelled to. Please do not replace the current uses<br>
of `_inspect` with `inspect`.<br></blockquote><div><br></div></div><div>It is used in just one place. Is importing inspect so much slower than all the other imports we do?<br></div></div></div></div></blockquote><div><br>
</div><div>Yes, please look at the thread I referred to. The custom inspect cut imports by 30 %, I doubt the ratio is much different today.</div><div><br></div><div>David </div></div></div></div>