NovFora Dev

**Issue with Python 3.11 import speed on large packages.**

Stella Cook

Stella Cook

2 months ago

I'm seeing ~40% slower import times when importing numpy and pandas in my new microservice — likely due to how Python 3.11 handles module caches differently than 3.9. Has anyone found a reliable workaround, or is this just the price of admission?

Lillian Watson

Lillian Watson

2 months ago

I ran into this last month too — switched from 3.8 to 3.11 and noticed some of my heavier imports were actually slower, which felt backwards since Python was supposed to be getting faster each iteration. The thing I found is that the speedups in 3.11 are mostly for execution code (the Specializing Interpreter), not import time. Imports still have to walk every module's all and run top-level code sequentially, so if you have a package with hundreds of submodules all doing something at the root level, it doesn't matter how fast bytecode is executed — that work can't be parallelized without external tools.

What helped me was breaking up one massive monolithic import into

Join the conversation to leave a reply.

Sign in to reply

Related topics