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

Optimize Report merging #867

Merged
merged 2 commits into from
Nov 11, 2024
Merged

Optimize Report merging #867

merged 2 commits into from
Nov 11, 2024

Conversation

Swatinem
Copy link
Contributor

@Swatinem Swatinem commented Nov 8, 2024

This change tries to optimize the slow Report.merge operation.

When merging report B into an existing report A, we can just use B in case A is empty. Also, the speed of merging depends on the size of the right hand size Report (B in this example). By swapping the reports, we can make sure to always merge the smaller Report into the larger one.

This change tries to optimize the slow `Report.merge` operation.

When merging report `B` into an existing report `A`, we can just use `B` in case `A` is empty.
Also, the speed of merging depends on the size of the right hand size Report (`B` in this example).
By swapping the reports, we can make sure to always merge the smaller Report into the larger one.
@Swatinem Swatinem requested a review from a team November 8, 2024 12:07
@Swatinem Swatinem self-assigned this Nov 8, 2024
Copy link

codecov bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.93%. Comparing base (fa2ef7c) to head (304eff3).
Report is 7 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #867      +/-   ##
==========================================
- Coverage   97.93%   97.93%   -0.01%     
==========================================
  Files         444      444              
  Lines       35476    35475       -1     
==========================================
- Hits        34744    34743       -1     
  Misses        732      732              
Flag Coverage Δ
integration 97.93% <100.00%> (-0.01%) ⬇️
unit 97.93% <100.00%> (-0.01%) ⬇️

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

Components Coverage Δ
NonTestCode 95.95% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.98% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
services/processing/merging.py 93.81% <100.00%> (+0.26%) ⬆️
services/report/raw_upload_processor.py 97.08% <100.00%> (+0.14%) ⬆️
tasks/compute_comparison.py 100.00% <100.00%> (ø)
tasks/tests/integration/test_upload_e2e.py 100.00% <100.00%> (ø)
tasks/upload_finisher.py 95.38% <100.00%> (-0.25%) ⬇️

... and 10 files with indirect coverage changes

@codecov-staging
Copy link

codecov-staging bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #867      +/-   ##
==========================================
- Coverage   97.93%   97.93%   -0.01%     
==========================================
  Files         444      444              
  Lines       35476    35475       -1     
==========================================
- Hits        34744    34743       -1     
  Misses        732      732              
Flag Coverage Δ
integration 97.93% <100.00%> (-0.01%) ⬇️
unit 97.93% <100.00%> (-0.01%) ⬇️

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

Components Coverage Δ
NonTestCode 95.95% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.98% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
services/processing/merging.py 93.81% <100.00%> (+0.26%) ⬆️
services/report/raw_upload_processor.py 97.08% <100.00%> (+0.14%) ⬆️
tasks/compute_comparison.py 100.00% <100.00%> (ø)
tasks/tests/integration/test_upload_e2e.py 100.00% <100.00%> (ø)
tasks/upload_finisher.py 95.38% <100.00%> (-0.25%) ⬇️

... and 10 files with indirect coverage changes

@codecov-qa
Copy link

codecov-qa bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.93%. Comparing base (fa2ef7c) to head (304eff3).
Report is 7 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #867      +/-   ##
==========================================
- Coverage   97.93%   97.93%   -0.01%     
==========================================
  Files         444      444              
  Lines       35476    35475       -1     
==========================================
- Hits        34744    34743       -1     
  Misses        732      732              
Flag Coverage Δ
integration 97.93% <100.00%> (-0.01%) ⬇️
unit 97.93% <100.00%> (-0.01%) ⬇️

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

Components Coverage Δ
NonTestCode 95.95% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.98% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
services/processing/merging.py 93.81% <100.00%> (+0.26%) ⬆️
services/report/raw_upload_processor.py 97.08% <100.00%> (+0.14%) ⬆️
tasks/compute_comparison.py 100.00% <100.00%> (ø)
tasks/tests/integration/test_upload_e2e.py 100.00% <100.00%> (ø)
tasks/upload_finisher.py 95.38% <100.00%> (-0.25%) ⬇️

... and 10 files with indirect coverage changes

Copy link

codecov-public-qa bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.93%. Comparing base (fa2ef7c) to head (304eff3).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #867      +/-   ##
==========================================
- Coverage   97.93%   97.93%   -0.01%     
==========================================
  Files         444      444              
  Lines       35476    35475       -1     
==========================================
- Hits        34744    34743       -1     
  Misses        732      732              
Flag Coverage Δ
integration 97.93% <100.00%> (-0.01%) ⬇️
unit 97.93% <100.00%> (-0.01%) ⬇️

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

Components Coverage Δ
NonTestCode 95.95% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.98% <100.00%> (+<0.01%) ⬆️
Files Coverage Δ
services/processing/merging.py 93.81% <100.00%> (+0.26%) ⬆️
services/report/raw_upload_processor.py 97.08% <100.00%> (+0.14%) ⬆️
tasks/compute_comparison.py 100.00% <100.00%> (ø)
tasks/tests/integration/test_upload_e2e.py 100.00% <100.00%> (ø)
tasks/upload_finisher.py 95.38% <100.00%> (-0.25%) ⬇️

... and 10 files with indirect coverage changes

session_mapping[intermediate_report.upload_id] = new_sessionid

if master_report.is_empty() and old_sessionid == new_sessionid:
# if the master report is empty, we can avoid a costly merge operation
Copy link
Contributor

Choose a reason for hiding this comment

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

This happens the very first time there's an upload for a commit right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes exactly, except when using carry-forwards

@Swatinem Swatinem added this pull request to the merge queue Nov 11, 2024
Merged via the queue into main with commit ecac6f0 Nov 11, 2024
26 of 27 checks passed
@Swatinem Swatinem deleted the swatinem/opt-merge branch November 11, 2024 08:38
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