Commit bd7e1edf authored by Jason R. Coombs's avatar Jason R. Coombs

Make memoized zip manifests opt-in using the PKG_RESOURCES_CACHE_ZIP_MANIFESTS...

Make memoized zip manifests opt-in using the PKG_RESOURCES_CACHE_ZIP_MANIFESTS environment variable. Ref #154.
parent e7df10e7
......@@ -6,8 +6,12 @@ CHANGES
5.4
---
* Issue #154: Cache the reading of the zip file index for cases where the
same zip-file is used for multiple packages (like PEX).
* Issue #154: ``pkg_resources`` will now cache the zip manifests rather than
re-processing the same file from disk multiple times, but only if the
environment variable ``PKG_RESOURCES_CACHE_ZIP_MANIFESTS`` is set. Clients
that package many modules in the same zip file will see some improvement
in startup time by enabling this feature. This feature is not enabled by
default because it causes a substantial increase in memory usage.
---
5.3
......
......@@ -1602,7 +1602,11 @@ class ZipProvider(EggProvider):
"""Resource support for zips and eggs"""
eagers = None
_zip_manifests = ZipManifests()
_zip_manifests = (
MemoizedZipManifests()
if os.environ.get('PKG_RESOURCES_CACHE_ZIP_MANIFESTS') else
ZipManifests()
)
def __init__(self, module):
EggProvider.__init__(self, module)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment