← 输入框|github.com|刷新
Skip to content

Unify worksheet readers around push consumption and reduce allocations - #771

Merged
appel1 merged 13 commits into
developfrom
issue525
Oct 24, 2026
Merged

appel1 merged 13 commits into
developfrom
issue525

Conversation

@appel1

@appel1 appel1 commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Unify worksheet reading across all formats around resumable push consumption, simplifying the pipelines and reducing unnecessary allocations.

  • Reuse parsing buffers and streamline style lookup, text decoding and cell conversion.
  • Restore logical row order and merge repeated row fragments in XLSX/XLSB default mode.
  • Fix a BIFF8 edge case where a final empty shared string was dropped, returning DBNull instead of "".

Performance

Comparison against develop across 424 test documents with matching output, using repeated full reads of every sheet and value:

Format Full-read time reduction Allocation reduction
CSV 75% 80%
XLS 26% 76%
XLSX/XLSM 2% 22%
XLSB Essentially unchanged 49%
SpreadsheetML 51% 86%

These are aggregate corpus results, not universal per-format gains. Representative larger XLSX documents read 9–11% faster. Subsequent key-derivation reuse reduced full-read time by 31–36% for five ordinary-password fixtures and about 49% for two default-password fixtures, compared with this branch before that optimization.

The empty-string correction above is the only output difference found in the corpus. Seven malformed documents failed identically in both versions.

Related to #525
Fixes #770

appel1 added 12 commits October 24, 2026 00:12
Use resumable row and cell callbacks across XLS, XLSX, XLSB, SpreadsheetML and CSV. Fill the shared current-row buffer directly, preserving format-specific decoding, scheduling and lifecycle behavior.
Index row overlaps during preparation and buffer only disordered regions. Merge repeated row fragments with last-write precedence; reject completed-row revisits in single-pass mode.
Decode XLS and XLSB records from reusable frames, remove superseded record wrappers and share style sinks. Validate XLSB framing and mark non-mutating handlers readonly.
Use span-based reads on modern targets, reduce compound-document startup buffers and optimize XLS string decoding. Preserve legacy framework and encrypted-stream paths.
Process ordinary field text in contiguous runs while preserving quoting, escaping, trimming and pause boundaries.
Index built-in formats directly, scan delimiters with IndexOf and match reference and format tokens as ASCII. Reuse boxed booleans and add focused lookup and materialization benchmarks.
Lazily share immutable public cell styles, decode shared-string escapes before storage and fast-path small unsigned numeric text with general-parser fallbacks.
Parse values with their resolved formatting and box only final dates and durations. Remove the temporary date wrapper and unused serial-date calculation; cover parsing fallbacks and access-pattern benchmarks.
Return the verified key to XLS and OpenXML startup instead of deriving it again. Reuse the Agile password hash to recover the package key, preserving magic-password precedence without adding a cache.
Avoid temporary UTF-16 password arrays during Standard and Agile key derivation. Cover empty passwords, Unicode surrogate pairs, and invalid-surrogate fallback behavior.
@appel1 appel1 self-assigned this Oct 24, 2026
Decrypt fallback segments directly into reusable buffers instead of allocating stream wrappers and output arrays per segment. Cover supported ciphers, cross-segment reads, seeks, and padded final segments.
@appel1
appel1 merged commit 863a888 into develop Oct 24, 2026
4 checks passed
@appel1
appel1 deleted the issue525 branch October 24, 2026 09:13
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.

XLS reader drops a final empty shared string at an SST record boundary

1 participant