Skip to content

Fix/speed up varro 1#502

Open
tim-band wants to merge 4 commits into
developmentfrom
fix/speed-up-varro-1
Open

Fix/speed up varro 1#502
tim-band wants to merge 4 commits into
developmentfrom
fix/speed-up-varro-1

Conversation

@tim-band

Copy link
Copy Markdown
Collaborator

This improves the loading of the Varro Antiquarian page from 63 seconds to about 36.

Updated from Django 3 to Django 4. This required a little bit of cleaning up some nastiness.

More is needed; it turns out I can't prefetch original_texts because Django 3 cannot cope with prefetching through a GenericRelation.

However, Django 5 can! Sadly I can't upgrade to Django 5 without upgrading Postgres.

So how about we do this, Django 4. Then if we need more speed we can upgrade to Postgres 14 and have a go at upgrading to Django 5. Then I can see if prefetching original_texts helps (probably will!).

@tim-band tim-band requested a review from tcouch May 18, 2026 09:10

@tcouch tcouch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure where the problem is occurring, but when running locally I'm not seeing any links show up under any of the works in the ordered material section:

Image

Comment thread src/rard/templates/research/partials/ordered_work_area.html Outdated
self.antiquarian = Antiquarian.objects.get(pk=pk)
return self.antiquarian
def get_response(self):
return HttpResponseRedirect(self.get_success_url())
self.antiquarian = Antiquarian.objects.get(pk=pk)
return self.antiquarian
def get_response(self):
return HttpResponseRedirect(self.get_success_url())

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You horror! Once it actually works it's no faster at all. Still, I found a small optimization that's nothing to do with all this work. To get any further I'll need Django 5. Will it actually be faster? I hope so.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think this work will really help get the original_text (and reference) prefetching working. But... it's a big job to make any of this stuff cover the work that all the templates are doing, especially getting display texts.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's why I thought lazy loading might be a better option: create a separate view for work lists and have htmx fetch the content when the user expands the accordion.

@tim-band tim-band force-pushed the fix/speed-up-varro-1 branch from be37472 to 5a9eec6 Compare June 17, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants