Merged
Conversation
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.
Performance: Virtual InMemoryRange for full column references
Formulas using full column references (e.g.
$A:$A,B:B) in dynamic array expressions caused severe performance degradation. EPPlus materialized 1,048,576 rows regardless of actual data, resulting in millions of unnecessary allocations and iterations.Changes
Virtual InMemoryRange — New concept separating physical size (backed by data) from logical size (full column). A
_virtualDefaultValuefield stores the pre-computed result for empty rows, avoiding per-cell allocation. Operators (+,*,=,&, etc.) compute the default once and propagate it through the chain.MATCH/XlookupScanner —
GetMaxItemsRownow usesGetAddressDimensionAdjustedto limit search to physical rows instead of iterating 1M rows.FormulaRangeAddress.HasFormulas — Loop clamped to worksheet dimension, eliminating 1M iterations per SUMIFS/AVERAGEIFS call with full column references.
Key files
InMemoryRange.cs— Virtual rows, default value propagationRangeOperationsOperator.cs—SetVirtualDefault,SetVirtualDefaultForRangesRangeHelper.cs—GetPhysicalRowsXlookupScanner.cs— Bounded searchFormulaRangeAddress.cs— BoundedHasFormulasResult
Benchmark workbook: 10.8 minutes → 2.6 seconds (~250x improvement). Full test suite (6200+ tests) green.