A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-February/020540.html below:

[Python-Dev] PEP 273 - Import from Zip Archives

[Python-Dev] PEP 273 - Import from Zip ArchivesJames C. Ahlstrom jim@interet.com
Thu, 28 Feb 2002 12:16:05 -0500
Gordon McMillan wrote:

> On 28 Feb 2002 at 9:44, James C. Ahlstrom wrote:
> 
>>The other objection raised at the time was the
>>possible slow down of imports. 
>>
> 
> imputil was 30 to 40% slower than C import. iu
> is about 10 to 15% slower under normal usage, but
> can be faster if you use archives and arrange sys.path
> intelligently.


I think I can add iu.py as the standard Python importer
to my import.c patches.  That is, if iu.py can be imported
(using C), then it takes over imports.  Note that the C code
changes to import.c are still required.  Also note that iu.py
may be in a zip file, and so the import.c changes are still
required.


>>My code uses os.listdir to cache directory
>>contents, but defers its use until the os module can
>>be imported using the C import code. 
>>
> 
> A win over some threshold of number of hits on
> that directory; a loss under that threshold.


Exactly correct.  It is tradeoff between the OS caching
directory hits from fopen() versus using a Python cache
and os.listdir().  Dramatic gains are obtained when importing
from network file systems, an important case.

 
JimA





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4