[Distutils] For maximum performance, Python packages are best installed as zip files.

Paul Moore p.f.moore at gmail.com
Mon Apr 11 09:00:41 EDT 2016


On 11 April 2016 at 13:46, Ionel Cristian Mărieș <contact at ionelmc.ro> wrote:
> On Mon, Apr 11, 2016 at 2:53 PM, Marius Gedminas <marius at gedmin.as> wrote:
>>
>> - multiple zipped eggs were slowest
>
>
> Afaik importing became slower and slower as you had more more eggs around.
> Haven't investigated what actually was the cause as I don't use eggs anymore
> but the idea that zips are good for performance is wrong - you need to look
> at a lot of zips (and unpack) to see what's importable. The zip importing
> caches worse than stating lots of directories, since it needs to cache file
> content while unzipped only needs metadata - correct me if I'm wrong.

I believe the issue with eggs is around the fact that they encourage
large numbers of items on sys.path (each egg gets its own sys.path
entry). That's slow, as there are lots of locations to be scanned for
each new import. TBH, though, I consider this a misuse of sys.path - I
see sys.path as analogous to $PATH, and you wouldn't typically install
each application in its own directory and add that directory to
$PATH.], so why do the equivalent with sys.path?

Paul


More information about the Distutils-SIG mailing list