[Distutils] extensions in packages

Fred L. Drake Fred L. Drake, Jr." <fdrake@acm.org
Wed, 26 May 1999 09:29:23 -0400 (EDT)

M.-A. Lemburg writes:
 > Note that this kind of search will be very costly due the amount
 > of IO needed to search the path. Some sort of fastpath hook

  Why does this need to be so costly?  Compared to the current scheme, 
there's little to add.  Once a package has been identified (and *only* 
then!), search the path for all the appropriate subdirectories (one
stat() for each path entry).  The current approach requires about a
half dozen stats for each path entry: foo.py, foo.py[co],
foomodule.so, foo.so, foo/ + foo/__init__.py + foo.__init__.py[co].
It will typically be even cheaper for sub-packages, because the
original path will usually be much shorter than sys.path.
  Note that I'm not saying there shouldn't be some sort of directory
caching; loading Grail is still dog slow, and I've no doubt that the
600+ stat() calls contribute to that!  1-)


Fred L. Drake, Jr.	     <fdrake@acm.org>
Corporation for National Research Initiatives