I have a third-party app (viewflow) that creates a lot of URLs. python manage.py show_urls
lists somewhere around 10000 urls. The first time calling reverse
takes about 10s right now. I used py-spy and pyinstrument to pinpoint the problematic bit to URLResolver._populate
. This method seems to compile each regex and populate the reverse lookup dict. Trouble is this is very slow when there are 10000 patterns. Of course this gets repeated on every autoreload.
Has any one run into this? Is there are known method to speed up this bit?