How big is python24.dll?

Thomas Heller theller at python.net
Tue Jul 13 10:49:05 EDT 2004


David Fraser <davidf at sjsoft.com> writes:

>>>>No, and no. python24.dll incorporates many extension modules which
>>>>were separate .pyd files before. In particular, it contains all .pyd
>>>>files which don't require additional libraries (DLLs or external
>>>>libraries).  A number of new extension modules were added for 2.4
>>>>also, which got incorporated into python24.dll.
>>
>>>>If you want to know the precise numbers, create a list of DLLs for
>>>>Python 2.3, and a similar list for Python 2.4, and see what files
>>>>went away. Also, compare the list of builtin modules to find out what
>>>>modules have been added since 2.3.
>>
>>>>If this kind of combination has any effect on the size, it rather
>>>>causes to safe space than to waste it: that way, Python ships with
>>>>less DLLs, which means fewer files, and less overhead for DLL data
>>>>structures.
>>>>
>>>
>>>It may save space for the standard Python build. But it will make it
>>>harder to save space on py2exe or frozen Python programs for example...

>> IIRC, Martin did this change because I requested it, with py2exe in
>> mind.  If you really want the smallest file size in the py2exe
>> builds, you may as well compile your own Python.dll, including only
>> those modules as buildins which you really need.
>
> OK, that's fine. How does it help py2exe then? Does anyone have a list
> of the modules added?

Well, you can print sys.builtin_module_names, which outputs this:

('__builtin__', '__main__', '_bisect', '_codecs', '_codecs_big5',
'_codecs_cp932', '_codecs_cp949', '_codecs_cp950',
'_codecs_euc_jisx0213', '_codecs_euc_jp', '_codecs_euc_kr',
'_codecs_gb18030', '_codecs_gb2312', '_codecs_gbk', '_codecs_hz ',
'_codecs_iso2022_jp', '_codecs_iso2022_jp_1', '_codecs_iso2022_jp_2',
'_codecs_iso2022_jp_3', '_codecs_iso2022_jp_ext ', '_codecs_iso2022_kr',
'_codecs_johab', '_codecs_mapdata_ja_JP', '_codecs_mapdata_ko_KR',
'_codecs_mapdata_zh_CN', '_codecs_mapdata_zh_TW', '_codecs_shift_jis',
'_codecs_shift_jisx0213', '_csv', '_heapq', '_hotshot', '_locale',
'_multibytecodec', '_random', '_sre', '_symtable', '_weakref',
'_winreg', 'array', 'audioop', 'binascii', 'cPickle', 'cStringIO',
'cmath', 'collections', 'datetime', 'errno', 'exceptions', 'gc',
'imageop', 'imp', 'itertools', 'marshal', 'math', 'md5' , 'mmap',
'msvcrt', 'nt', 'operator', 'parser', 'regex', 'rgbimg', 'rotor', 'sha',
'signal', 'strop', 'struct', 'sys', ' thread', 'time', 'xreadlines',
'xxsubtype', 'zipimport')

Maybe more interesting is which modules remain non-builtin, here's the
list from the Python 2.4 DLLs directory:

12.07.2004  21:27            73.728 bz2.pyd
12.07.2004  21:25           135.168 pyexpat.pyd
12.07.2004  21:26             8.192 select.pyd
18.06.2004  16:53           566.272 tcl84.dll
18.06.2004  16:53             5.120 tclpip84.dll
18.06.2004  17:03         1.027.584 tk84.dll
12.07.2004  21:26           405.504 unicodedata.pyd
12.07.2004  21:23             6.656 winsound.pyd
12.07.2004  21:24            65.536 zlib.pyd
12.07.2004  21:29           692.224 _bsddb.pyd
12.07.2004  21:29            49.152 _socket.pyd
12.07.2004  21:29           479.232 _ssl.pyd
12.07.2004  21:28            12.800 _testcapi.pyd
12.07.2004  21:27            40.960 _tkinter.pyd

So, in *some* cases, py2exe only creates three files:
python24.dll, library.zip, and yourapp.exe.

Maybe the CJK codecs should be moved into separate pyds again, although
that may depend on the part of the world you (or the users of your
program) live in.  Myself, I don't care too much about the python24.dll size.

Thomas



More information about the Python-list mailing list