Repository navigation
Clear a merged range by its stored cells, not its advertised area - #9
Merged
Merged
Conversation
Clearing the covered cells of a <mergeCell> visited every position in the rectangle, so a 2 KB workbook merging A1:ALL10000 around a single cell cost ten million iterations, and a full-grid merge about three minutes, before the first cell could be read. The walk now visits the rows and cells the sheet actually stores inside the range (whichever of range width or stored count is smaller), keeping the covered-border behaviour: a covered styled cell keeps its style and loses its value. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.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.
Problem. When a sheet is parsed, the cells covered by each
<mergeCell>are cleared by visiting every position of the rectangle. The rectangle comes
from the file, so a 2.4 KB workbook with one cell and
A1:ALL10000costs tenmillion iterations, and a single
A1:XFD1048576around one cell took aboutthree minutes before the first cell could be read; distinct refs multiply
that. Inherited from the original package.
Fix. The walk visits the rows and cells the sheet actually stores inside
the range, choosing per dimension whichever is smaller: the range's width or
the stored count. Keys are collected before mutation. The covered-border
behaviour from #3 is unchanged: a covered cell keeps its style and loses its
value.
Validation.
test/reader_test.dart, "Merged Range Parsing": a full-gridmerge around one cell (effectively hangs before, sub-second after) and a
value/style check on covered cells.
empty_merged_border_testand the rest ofthe suite pass. ALL10000 goes from ~100 ms to 2 ms.
🤖 Generated with Claude Code