Splitting up large python module impact on performance?

dieter dieter at handshake.de
Wed Jun 13 01:12:10 EDT 2018


Bill Deegan <bill at baddogconsulting.com> writes:
> I'm doing some refactoring on a fairly large python codebase.
> Some of the files are > 4000 lines long and contain many classes.

I am typically working with systems consisting of hundreds of
modules (Zope/Plone). Such large systems have a significant
impact on startup time (caused by extensive file system operation
during startup). For one application, I had to significantly
optimize to get an acceptable startup time: I have put most
of the application modules into zip archives).

> Should I expect any performance hit from splitting some of the classes out
> to other files?

Important is the number of resulting modules (and how fast
your file system is): for each module, Python accesses the file system
potentially many times (up to 4 times, when my memory is right)
and this may significantly slow down startup (if a large number
of modules must be imported).




More information about the Python-list mailing list