Splitting up large python module impact on performance?

Gregory Ewing greg.ewing at canterbury.ac.nz
Tue Jun 12 20:57:30 EDT 2018


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

I doubt it. Time taken to load modules is mostly dependent on
the total amount of code, not how many files it lives in.

If you had a *very* large number of tiny files, it might be a
bit slower due to all the stat calls required, but I wouldn't
worry about it too much. Just structure you code in a way that
makes sense, and deal with performance problems if and when
the occur.

-- 
Greg



More information about the Python-list mailing list