TLDR: if your model saves are slow check the types
I'm new to python/django and made a stupid mistake. I have a model with author = models.TextField() and to create it I passed in thirdpartyclass.author.
It worked but was crazy slow. Like 1-5 seconds per model save. 500 saves just didn't ever finish.
What I tried:
1. Maybe its sqlite3, I'll upgrade to postgres
2. Maybe the queries are slow, enable postgres logging and see sensible inserts taking 8ms
3. Make absolutely sure it's the .save by measuring time elapsed.
4. Create a new model and add fields till the slow down happens - it never happens because I used fake data
5. Try explicitly casting everything to the correct data type before creating the model object - success
I have no idea how the django object relation mapper works but it was just choking on this third party object that I thought was a string. Calling str(thirdpartyclass.author) gave me a 1000x speedup.