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

Paul Moore p.f.moore at gmail.com
Mon Apr 11 07:16:47 EDT 2016


On 11 April 2016 at 12:08, Donald Stufft <donald at stufft.io> wrote:
>> On Apr 11, 2016, at 7:04 AM, Thomas Güttler <guettliml at thomas-guettler.de> wrote:
>>
>> From https://pythonhosted.org/setuptools/setuptools.html#setting-the-zip-safe-flag
>>
>> > For maximum performance, Python packages are best installed as zip files.
>>
>> What kind of performance improvement is this?
>>
>> Is this improvement really measurable?
>>
>> What improvement numbers do you get?
>>
>
> I’m not sure if that is still the case with modern SSDs, but I think the idea is that by putting everything inside of zip files you reduce the number of stat calls that Python needs to do (they flip side of this is that pkg_resources is incredibly slow because it needs to issue a ton of stat calls on import).

I believe that recent versions of Python also did a lot to improve the
number of stat calls done on import. So very definitely YMMV. If the
performance difference matters, then you should test carefully.

Paul


More information about the Distutils-SIG mailing list