Performance when working directory is slow network drive

David Bolen db3l at fitlinxx.com
Thu Mar 1 20:08:41 EST 2001


"Mark Hadfield" <m.hadfield at niwa.cri.nz> writes:

> 1. Why having the current directory in the search path affects the import
> time for the os module much more than it does for other modules I tested
> (like string). Is this because os is a package?

The os module isn't a package, but it does reference other modules.  I
can think of two possibilities for the performance difference:

* The os module itself imports various other things including the
system specific path module so there's just more going on and thus
more access to the current directory for import lookups.

* The os module also along the way imports the string module under
Windows (from within ntpath.py), so by the time your import of os
finishes, you already have the string module loaded, and thus if you
import os before you do string, the string import really doesn't do
much.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list