Closed angusholder closed 4 months ago
Thanks, that is an easy win. I added a changelog note and improved the comment.
This function could be improved further to not use django.test
and instead capture the query with database instrumentation, if you’re up for the challenge.
After sending this, I realised it was your blog posts I read recently about improving Django start time, so thanks for those!
Might have a go at that database instrumentation change later, I haven't seen it before, looks interesting.
Glad you enjoyed them!
I also have some blog posts on database instrumentation that may inform: https://duckduckgo.com/?t=ffab&q=site%3Aadamj.eu+%22database+instrumentation%22&ia=web
The suggestion is just an “if you’re interested”, I don't use pt_visual_explain
myself, at the moment, and I guess you don’t either :)
I was running a flamegraph on our manage.py, and noticed this import of
django.test
using 20-40ms. Seems like an easy win for startup time to make it a lazy import, because most production code wouldn't normally ever need thedjango.test
module.