✍️ New post on using Memray to profile the memory usage of a Django project.
You can use this tool to find and eliminate memory-costly lines of code. The example in the post finds and removes a costly import, reducing startup time.

Django: profile memory usage with Memray - Adam Johnson
Memory usage can be hard to keep under control in Python projects. The language doesn’t make it explicit where memory is allocated, module imports can have signficant costs, and it’s all too easy to create a global data structure that accidentally grows unbounded, leaking memory. Django projects can be particularly susceptible to memory bloat, as they may import many large dependencies like numpy, even if they’re only used in a few places.
adamj.eu
Link author:
Adam Johnson
@adamchainz@fosstodon.org