Fix/speed up varro 1#502
Open
tim-band wants to merge 4 commits into
Open
Conversation
tcouch
reviewed
May 18, 2026
tcouch
reviewed
May 18, 2026
| 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()) |
Collaborator
Author
There was a problem hiding this comment.
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.
Collaborator
Author
There was a problem hiding this comment.
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.
Collaborator
There was a problem hiding this comment.
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.
Thanks! That sorts it. Co-authored-by: Tom Couch <t.couch@ucl.ac.uk>
be37472 to
5a9eec6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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!).