8000 Optimize `ArchiveField` reads by Swatinem · Pull Request #603 · codecov/shared · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Optimize ArchiveField reads #603

Merged
merged 2 commits into from
Apr 11, 2025
Merged

Optimize ArchiveField reads #603

merged 2 commits into from
Apr 11, 2025

Conversation

Swatinem
Copy link
Contributor

This consists of two optimizations:

  • It prefers the archive_field over the db_field, and can thus avoid some queries for the db_field, as some queries in API are explicitly defer-ing that load.
  • It also avoids initializing the ArchiveService.storage_hash, which we don’t need for reads (only writes), and which would require us to load the related repository and owner.

@Swatinem Swatinem requested a review from a team April 11, 2025 09:42
@Swatinem Swatinem self-assigned this Apr 11, 2025
Copy link
codspeed-hq bot commented Apr 11, 2025

CodSpeed Performance Report

Merging #603 will not alter performance

Comparing swatinem/archivefield-read (f8baa45) with main (a235055)

Summary

✅ 9 untouched benchmarks

This consists of two optimizations:
- It prefers the `archive_field` over the `db_field`, and can thus avoid some queries for the `db_field`, as some queries in API are explicitly `defer`-ing that load.
- It also avoids initializing the `ArchiveService.storage_hash`, which we don’t need for reads (only writes), and which would require us to load the related repository and owner.
@Swatinem Swatinem force-pushed the swatinem/archivefield-read branch from 2ca1330 to 1e42b98 Compare April 11, 2025 10:23
Copy link
Contributor
@giovanni-guidini giovanni-guidini left a comment

Choose a reason for hiding this comment

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

lgtm... but can we get rid of ArchiveField you think?
It's been quite a long time, do any objects remain that have the value in the DB, not in the archive at this point?

@Swatinem
Copy link
Contributor Author

Probably not in our production environment, but I don’t know about self-hosted. So I am rather not touching this.

Copy link
codecov bot commented Apr 11, 2025

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.60%. Comparing base (a235055) to head (f8baa45).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
shared/django_apps/utils/model_utils.py 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #603      +/-   ##
==========================================
- Coverage   88.60%   88.60%   -0.01%     
==========================================
  Files         463      463              
  Lines       12776    12773       -3     
  Branches     1454     1455       +1     
==========================================
- Hits        11320    11317       -3     
  Misses       1151     1151              
  Partials      305      305              
Flag Coverage Δ
shared-docker-uploader 88.60% <91.66%> (-0.01%) ⬇️

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.

@codecov-notifications
Copy link
codecov-notifications bot commented Apr 11, 2025

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
shared/django_apps/utils/model_utils.py 91.66% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@Swatinem Swatinem added this pull request to the merge queue Apr 11, 2025
Merged via the queue into main with commit 9401035 Apr 11, 2025
12 checks passed
@Swatinem Swatinem deleted the swatinem/archivefield-read branch April 11, 2025 11:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0