Repository navigation
JSE-52: linear sheet and relationship lookup, maxSheets limit, abort checks in the workbook phase - #130
Merged
Conversation
…checks in the workbook phase
…pan only their range; abort checks in synchronous loops
…ells; maxCells counts cells only; tests for every abort check
This was referenced Dec 1, 2026
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.
What
readandreadSheetNameslooked up each sheet's relationship with a scan over all relationships, and summed sheet sizes withindexOfper sheet: quadratic in the number of<sheet>entries. Relationships are now indexed once; the same for hyperlink relationships per sheet.<col>ranges. Each<col min max>element wrote its properties into every column of its range, so many full-width elements cost 16,384 allocations each. Ranges are now applied in batches from last to first, skipping columns a later range already took; the result is the same (later element wins).maxSheets(default 10,000, optional member ofReadLimits): the number of sheetsxl/workbook.xmlmay declare. Over it,LimitError(LIMIT_EXCEEDED) while that part is parsed, before any per-sheet work.readSheetNameshonours it.Why
A workbook declaring very many sheets took minutes to open and blocked the event loop without consulting the abort signal. Measured on 2.1.0 (Node 26):
readwith one sheet named, 10,000 entries 0.9 s;readSheetNames, 40,000 entries 3.5 s;read, 80,000 entries (a 1 MB file) about 26–59 s in one block.After: 10,000 entries 57 ms (longest block 15 ms); more are refused by the default limit in under 20 ms; with the limit raised, 140,000 entries read in 0.5 s (longest block 39 ms).
Compatibility
Results, warnings and errors are unchanged for files under the new limit.
maxSheetsis optional in the public type, so a full 2.1-styleReadLimitsobject still compiles. Ordinary reads (100k and 1M cells) are within noise of 2.1.0.Tests
read(one sheet named, all sheets) andreadSheetNames; hyperlinks;<col>ranges, with a randomised comparison against the previous algorithm.maxSheetsat and over the limit; it trips before any phase afterunzip.