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 of extract_related() #532

Closed
wants to merge 1 commit into from

Conversation

juyrjola
Copy link

Check more thoroughly if the related resource is already included in the response, and skip serialization if it is. For my workload with a lot of included resources, this optimization decreased the list endpoint processing time by around 50 %, because extract_related() was repeating serialization for many of the resources that were already included in the response.

@codecov
Copy link

codecov bot commented Dec 13, 2018

Codecov Report

Merging #532 into master will decrease coverage by 0.52%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #532      +/-   ##
==========================================
- Coverage   96.11%   95.58%   -0.53%     
==========================================
  Files          56       55       -1     
  Lines        2859     2856       -3     
==========================================
- Hits         2748     2730      -18     
- Misses        111      126      +15
Impacted Files Coverage Δ
rest_framework_json_api/renderers.py 86.94% <66.66%> (+0.14%) ⬆️
rest_framework_json_api/metadata.py 25% <0%> (-23.34%) ⬇️
example/tests/test_filters.py 100% <0%> (ø) ⬆️
example/settings/dev.py 100% <0%> (ø) ⬆️
example/tests/integration/test_pagination.py 100% <0%> (ø) ⬆️
example/tests/integration/test_polymorphism.py 100% <0%> (ø) ⬆️
example/models.py 100% <0%> (ø) ⬆️
example/tests/test_serializers.py 100% <0%> (ø) ⬆️
rest_framework_json_api/django_filters/backends.py 100% <0%> (ø) ⬆️
example/tests/unit/test_utils.py 100% <0%> (ø) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5650bd1...dd2506c. Read the comment docs.

Copy link
Member

@sliverc sliverc left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution. Could you add a test that covers both continue statements (also see codecov)?

This will show that this improvement works.

@sliverc
Copy link
Member

sliverc commented May 6, 2019

@juyrjola Are you still interested in working on this PR? A test is missing as a last task.

Check more thoroughly if the related resource is already included
in the response, and skip serialization if it is.
@sliverc
Copy link
Member

sliverc commented Aug 15, 2019

As there hasn't been any response to #532 (comment) concerning a test and proving this improvement I am closing this for now.

Please feel free to reopen if you continue working on it though.

@sliverc sliverc closed this Aug 15, 2019
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

2 participants