Skip to content
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

Improve performance for feedback views #1089

Merged
merged 1 commit into from
Jan 15, 2022

Conversation

membralala
Copy link
Contributor

Short description

This PR should improve performance for the admin and region feedback views as it reduces the amount of database queries.

Proposed changes

@membralala membralala requested a review from a team as a code owner January 5, 2022 16:26
@david-venhoff david-venhoff force-pushed the feature/reduce-feedback-queries branch from ae642ee to 8753e4b Compare January 5, 2022 16:48
@svenseeberg
Copy link
Member

@membralala can you please elaborate why the polymorphic module improves performance? The reasons for making the change is not really clear to me. I expect that you did not find this by chance?

@timobrembeck
Copy link
Member

timobrembeck commented Jan 5, 2022

Can you please elaborate why the polymorphic module improves performance? The reasons for making the change is not really clear to me. I expect that you did not find this by chance?

@svenseeberg This is the explanation: https://django-polymorphic.readthedocs.io/en/stable/performance.html#performance
The get_real_instance() mentioned there is roughly equivalent to our Feedback.submodel_instance().

Copy link
Member

@timobrembeck timobrembeck left a comment

Choose a reason for hiding this comment

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

Thanks a lot 😍

Since django-polymorphic improves the performance pretty significantly and makes it possible to remove some of our "magic" submodel-instance code (which ultimately improves maintainability of our code base), I think it's justified to add another dependency here. Also, the other changes look very clean and straight-forward to me, good job!

- Add django-polymorphic
- Add some cached_properties in the feedback models
- Reduce queries regarding the feedback models

Co-authored-by: David Venhoff <venhoff@integreat-app.de>
@timobrembeck timobrembeck force-pushed the feature/reduce-feedback-queries branch from 7d8295f to d70a8ee Compare January 15, 2022 14:11
@timobrembeck timobrembeck merged commit 00610f0 into develop Jan 15, 2022
@timobrembeck timobrembeck deleted the feature/reduce-feedback-queries branch January 15, 2022 14:15
@david-venhoff david-venhoff mentioned this pull request Jan 15, 2022
16 tasks
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.

None yet

3 participants