Skip to content

fix: inefficient merge check for large amount of merged cells#2920

Open
3ximus wants to merge 2 commits intoexceljs:masterfrom
3ximus:aorsten/fix/ineffective-merge-check
Open

fix: inefficient merge check for large amount of merged cells#2920
3ximus wants to merge 2 commits intoexceljs:masterfrom
3ximus:aorsten/fix/ineffective-merge-check

Conversation

@3ximus
Copy link
Copy Markdown

@3ximus 3ximus commented Apr 17, 2025

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

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants