perf: Clip column range instead of filtering in V2 DataLocator - #1032
Open
nightscape wants to merge 2 commits into
Open
perf: Clip column range instead of filtering in V2 DataLocator#1032nightscape wants to merge 2 commits into
nightscape wants to merge 2 commits into
Conversation
When dataAddress specifies only a starting cell, colInd becomes a huge range (e.g. 1 to 16383). The previous code iterated the entire range per row using .filter(), causing O(rows * maxColumns) comparisons. Replace with direct range clipping: colInd.start to min(colInd.last, lastCellNum - 1). This is O(1) per row and also hoists the getLastCellNum call out of the per-element evaluation. Fixes #720 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Failed to generate code suggestions for PR |
There was a problem hiding this comment.
Pull request overview
Improves the performance of V2 Excel reading by avoiding per-row iteration over the full maximum Excel column range when dataAddress specifies only a starting cell.
Changes:
- Introduces a helper to read row cells with column-range clipping based on
Row.getLastCellNum. - Hoists
getLastCellNumevaluation to once per row and replacesRange.filterwith O(1) effective-range construction.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
colInd.filter(_ < r.getLastCellNum)with direct range clipping (colInd.start to min(colInd.last, lastCellNum - 1)), avoiding O(maxColumns) iteration per rowgetLastCellNumevaluation to once per row instead of once per column indextakeWhile)When
dataAddressspecifies only a starting cell,colIndbecomes1 to 16383. For a file with 1M rows and 23 actual columns, the old code performed ~16 billion unnecessary comparisons. This change eliminates them entirely.Test plan
returns all data rows when inferring schema)🤖 Generated with Claude Code