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

Fix #144 -- Improve DRM serialization performance by filtering source and ratio #148

Merged

Conversation

amureki
Copy link
Collaborator

@amureki amureki commented Jan 23, 2024

This is an early draft of a possible direction.
I did not go all fancy and did not add tests before I validate this with you.

The manual test on 5000 objects showed me this:

DRF ImageField serialization TIME:  0.15182900428771973
PictureField serialization TIME:  12.384335041046143
PictureField serialization IMPROVED TIME:  3.4643609523773193

@amureki amureki force-pushed the 144-drf-field-filtered-representation branch from cbe1255 to 2f94b4c Compare January 23, 2024 15:33
Copy link

codecov bot commented Jan 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (33562b8) 100.00% compared to head (7c7e943) 100.00%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #148   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines          459       470   +11     
=========================================
+ Hits           459       470   +11     
Flag Coverage Δ
celery 82.34% <0.00%> (-1.98%) ⬇️
cleanup 82.97% <0.00%> (-1.99%) ⬇️
dj4.1 82.97% <0.00%> (-1.99%) ⬇️
dj4.2 82.97% <0.00%> (-1.99%) ⬇️
django-rq 82.34% <0.00%> (-1.98%) ⬇️
dramatiq 82.34% <0.00%> (-1.98%) ⬇️
drf 92.97% <100.00%> (+0.16%) ⬆️
macos-latest 83.19% <0.00%> (-2.00%) ⬇️
py3.10 82.97% <0.00%> (-1.99%) ⬇️
py3.12 82.97% <0.00%> (-1.99%) ⬇️
py3.8 82.97% <0.00%> (-1.99%) ⬇️
py3.9 82.97% <0.00%> (-1.99%) ⬇️
ubuntu-latest 82.97% <0.00%> (-1.99%) ⬇️
windows-latest 74.36% <0.00%> (-2.69%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@codingjoe codingjoe left a comment

Choose a reason for hiding this comment

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

Excellent! This looks promising, I left you several fussy comments. But overall, once you add test, for the new kwargs, this is ready to ship.

pictures/contrib/rest_framework.py Outdated Show resolved Hide resolved
pictures/contrib/rest_framework.py Outdated Show resolved Hide resolved
pictures/contrib/rest_framework.py Show resolved Hide resolved
@amureki
Copy link
Collaborator Author

amureki commented Jan 24, 2024

@codingjoe got me to the question - should we handle cases when user only provides aspect ratio OR image source?
This would be a matter of a couple more elifs, or we also could go with some fancy matcher to solve that.

@amureki amureki requested a review from codingjoe January 25, 2024 07:57
Copy link
Owner

@codingjoe codingjoe left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @amureki

@codingjoe codingjoe changed the title Fix #144 -- improve performance by filtering source and ratio Fix #144 -- Improve DRM serialization performance by filtering source and ratio Jan 25, 2024
@codingjoe codingjoe merged commit fe94f1c into codingjoe:main Jan 25, 2024
24 checks passed
@amureki amureki deleted the 144-drf-field-filtered-representation branch January 26, 2024 09:37
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.

2 participants