Skip to content

Avoid looking up absent cells in rangeResolver #2111

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

Merged
merged 2 commits into from
Mar 29, 2025

Conversation

paolobarbolini
Copy link
Contributor

@paolobarbolini paolobarbolini commented Mar 27, 2025

PR Details

While benchmarking the performance of SUMIFS I've discovered that when a range references an entire column or an entire row, excelize scans the entire theoretical range even if the file is smaller than that. This was already discovered by #2056.

Description

I've initially tried to reduce the scan range, but a lot of the code assume that rangeResolver is going to be scanning the entire range, so I've changed it to instead skip looking up cells that don't exist.

Related Issue

#2056

Motivation and Context

This makes a big performance difference.

How Has This Been Tested

I've run tests and also tested this on my projects.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PR developed together with @Aprax14.

Copy link

codecov bot commented Mar 28, 2025

Codecov Report

Attention: Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 99.22%. Comparing base (91d36cc) to head (c82c7e3).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
calc.go 85.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2111      +/-   ##
==========================================
+ Coverage   99.20%   99.22%   +0.02%     
==========================================
  Files          32       32              
  Lines       30102    30114      +12     
==========================================
+ Hits        29864    29882      +18     
+ Misses        158      154       -4     
+ Partials       80       78       -2     
Flag Coverage Δ
unittests 99.22% <85.00%> (+0.02%) ⬆️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@paolobarbolini paolobarbolini changed the title Reduce rangeResolver scanned ranges to cells available in the worksheet Avoid looking up absent cells in rangeResolver Mar 28, 2025
@paolobarbolini paolobarbolini marked this pull request as ready for review March 28, 2025 10:31
@xuri xuri added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 28, 2025
@xuri xuri linked an issue Mar 29, 2025 that may be closed by this pull request
@xuri xuri added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 29, 2025
Copy link
Member

@xuri xuri 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 for your contribution. I added unit test based on your branch.

@xuri xuri merged commit 3650e5c into qax-os:master Mar 29, 2025
16 of 17 checks passed
@xuri xuri linked an issue Apr 24, 2025 that may be closed by this pull request
@xuri xuri mentioned this pull request Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Very slow SUMIF performance when using "Row Range Notation" parseReference issue
2 participants