<br><br><div class="gmail_quote">On Tue, Feb 7, 2012 at 18:26, Alex Gaynor <span dir="ltr">&lt;<a href="mailto:alex.gaynor@gmail.com">alex.gaynor@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im">Brett Cannon &lt;brett &lt;at&gt; <a href="http://python.org" target="_blank">python.org</a>&gt; writes:<br>
<br>
<br>
&gt; IOW you want the sys.modules case fast, which I will never be able to match<br>
compared to C code since that is pure execution with no I/O.<br>
&gt;<br>
<br>
<br>
</div>Sure you can: have a really fast Python VM.<br>
<br>
Constructive: if you can run this code under PyPy it&#39;d be easy to just:<br>
<br>
$ pypy -mtimeit &quot;import struct&quot;<br>
$ pypy -mtimeit -s &quot;import importlib&quot; &quot;importlib.import_module(&#39;struct&#39;)&quot;<br>
<br>
Or whatever the right API is.</blockquote><div><br></div><div>I&#39;m not worried about PyPy. =) I assume you will just  flat-out use importlib regardless of what happens with CPython since it is/will be fully compatible and is already written for you. </div>

</div>