Repository navigation
Perf/reduce allocations - #767
Merged
Merged
Conversation
Lazily assemble XLSX and SpreadsheetML text fragments and decode OOXML escapes without regex allocations on modern targets. Add regression coverage and allocation benchmarks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Accumulate classification flags without retaining parsed sections and parse condition numbers from spans on supported targets. Expand format regression coverage and benchmarks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace temporary token strings and unused section models with classification-only parsing. Preserve existing behavior with frozen runtime-specific characterization fixtures and expand long-format benchmarks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Summary
Reduce allocations in XML string reading and custom number-format parsing without changing the public API or existing parsing behavior.
Allocation and performance results
Measurements used BenchmarkDotNet on .NET 10, with warmed, repeated runs on the same machine. Allocations below are bytes per benchmark operation; XML workloads read generated workbooks, while parser workloads parse one format.
XML strings
Multipart/rich-text workloads retain their existing allocations, with no statistically meaningful throughput regression.
Number-format parsing
The final range-based refactor reduced short-format allocations by approximately 75–90% and elapsed time by 56–78% compared with its immediate baseline, which already included the earlier parser improvements.
00.00# ?/?#,##0.00;[Red]-#,##0.00[>=100]0.00;[Blue][h]:mm:ssyyyy-mm-dd hh:mm:ss.000The parser is not allocation-free: the format object and temporary token collection still allocate.
Whole-file guardrails
The final parser comparison also showed lower elapsed times for representative workbooks:
These are workload-specific measurements, not a promise of universal speedups. No statistically meaningful slowdown was detected in the accepted benchmark comparisons. Results from separate optimization stages are reported independently rather than adding their percentages together.