fix: inefficient merge check for large amount of merged cells#2920
Open
3ximus wants to merge 2 commits intoexceljs:masterfrom
Open
fix: inefficient merge check for large amount of merged cells#29203ximus wants to merge 2 commits intoexceljs:masterfrom
3ximus wants to merge 2 commits intoexceljs:masterfrom
Conversation
privatecoder
added a commit
to privatecoder/exceljs
that referenced
this pull request
Sep 24, 2025
nfcampos
pushed a commit
to witanlabs/exceljs
that referenced
this pull request
Nov 26, 2025
…nce O(n²) → O(n) The original implementation iterated through ALL existing merges for each new merge operation, causing O(n²) complexity that became extremely slow with many merges (30,000 merges took 1.5 minutes). This fix checks individual cells directly via the `cell.isMerged` property instead, reducing complexity to O(m) where m is the merge area size. Performance improvement with 10,000 merges: 6464ms → 34ms (190x faster) Original PR: exceljs#2920 Based on: exceljs#2691 Co-Authored-By: aorsten <[email protected]> Co-Authored-By: 3ximus <[email protected]>
nfcampos
added a commit
to witanlabs/exceljs
that referenced
this pull request
Nov 26, 2025
…jPYqutcWxrbar2r9hBK perf: Adopt upstream PR exceljs#2920 - Optimize merged cells performance O(n²) → O(n)
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.
This pull request is the same as this stale one #2691 with the comments applied to it. I would really like to see this merge.
Thank you