Lazy imports in Python help a command line tool start faster, but under a pre-fo...
Graham Dumpleton @grahamdumpleton@mastodon.social
Lazy imports in Python help a command line tool start faster, but under a pre-forking web server deferring an import can make things worse. Each worker loads the module itself on first use, and that memory is no longer shared.
The latest post in my Muru series looks at how Muru measures imports, so you can decide what to defer and what to load before the fork.
https://grahamdumpleton.me/posts/2026/11/muru-when-lazy-imports-help/