title: Speeding up the python "import" loader
body: <p>I'm getting seriously frustrated at how slow python startup is.  Just importing more or less basic modules takes a second, since python runs down the sys.path looking for matching files (and generating 4 <code>stat()</code> calls - ["foo", "foo.py", "foo.pyc", "foo.so"] - for each check).  For a complicated project environment, with tons of different directories, this can take around 5 seconds -- all to run a script that might fail instantly.</p>
  
  <p>Do folks have suggestions for how to speed up this process?  For instance, one hack I've seen is to set the <code>LD_PRELOAD_32</code> environment variable to a library that caches the result of <code>ENOENT</code> calls (e.g. failed <code>stat()</code> calls) between runs.  Of course, this has all sorts of problems (potentially confusing non-python programs, negative caching, etc.).</p>