-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track number of queries in tests #3347
Comments
This is complicated by us doing several queries in our templates. To track both we have to wrap both the view call and
This is a good time to try out methods for ensuring we don't pass rich objects to the template. Maybe a method on a model that produces a dict? (or a dataclass/attr's class?) |
Could we narrow down the scope of this ticket to just one of these ideas, please? Perhaps focusing on adding a test for the homepage for now or for one of the pages that Tom O is about to change? This change could then be used as a pattern for applying to future tests when we next come to make changes to any views/templates. |
There's only two ideas here, count queries and push all queries to the view to avoid paying the cost of template rendering in tests. The work for this ticket is really working out a method or tools that we like for doing these and then applying them to each view, using the list above to track progress. |
Another approach is to use Honeycomb to profile which pages are actually slow in production then raise issues to spot-resolve them. That's possibly more targeted at problems. django-silk is a useful profiling tool that might be a more natural fit than home-rolling performance metrics within the testing framework. |
We're starting to see a few performance issues recently, and particularly with the removal of an implicit query (#3323), and the removal of orgs from urls (#3312).
It would be useful to have some query counts in our tests, but it's not clear how many pages we should do this for. Lets err on the side of adding them to the success test case for each page to start with.
The homepage has various objects in it so it's an obvious first target to try this out.
Templates:
The text was updated successfully, but these errors were encountered: