[issue8745] zipimport is a bit slow
New submission from Goplat : Reading the list of files in a .zip takes a while because several seeks are done for each entry, which (on Windows at least) flushes stdio's buffer and forces a system call on the next read. For large .zips the effect on startup speed is noticeable, being perhaps 50ms per thousand files. Changing the read_directory function to read the central directory entirely sequentially would cut this time by more than half. -- components: Interpreter Core files: zipimport_speedup.patch keywords: patch messages: 105954 nosy: Goplat priority: normal severity: normal status: open title: zipimport is a bit slow type: performance versions: Python 2.6 Added file: http://bugs.python.org/file17387/zipimport_speedup.patch ___ Python tracker <http://bugs.python.org/issue8745> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8745] zipimport is a bit slow
Goplat added the comment: Zipping up the Lib directory from the python source (1735 files) as a test, it took on average 0.10 sec to read the zip before, 0.04 sec after. (To test the time taken by zipimport isolated from other startup costs, instead of actually getting the zip in the import path, I just ran import time, zipimport; start = time.clock(); zipimport.zipimporter("lib.zip"); print time.clock() - start) -- ___ Python tracker <http://bugs.python.org/issue8745> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com