Skip to content

Enhance ExcelWriter functionality with tests, refactoring, and CI updates#14

Merged
GabrielMarquezMatte merged 10 commits into
masterfrom
develop
Jun 28, 2026
Merged

Enhance ExcelWriter functionality with tests, refactoring, and CI updates#14
GabrielMarquezMatte merged 10 commits into
masterfrom
develop

Conversation

@GabrielMarquezMatte

Copy link
Copy Markdown
Owner

This pull request introduces several improvements and optimizations across the codebase, focusing on enhanced memory efficiency, code modernization, and updated documentation. The most significant updates include improved memory usage in the OLE compound file reader, modernized C# syntax, and expanded documentation for shared strings support in XLSX/XLSB writers. Additionally, the CI workflow is updated to include the develop branch, and minor bug fixes and code cleanups are applied.

Memory and performance optimizations:

Documentation updates:

  • README.md: Updated benchmark results for .NET 10.0.9 (SDK 11.0.100-preview.4), added documentation for opt-in shared strings in XLSX/XLSB writers, and clarified performance comparisons. [1] [2] [3] [4]

Code modernization and bug fixes:

CI workflow improvements:

  • .github/workflows/ci.yml: CI now runs on both master and develop branches, ensuring better coverage for in-progress work.

Maintenance and extensibility:

gabriel-matte-nf and others added 10 commits June 27, 2026 13:08
…ionality; enhance existing tests for async enumerators and limit checks
…o assert exceptions and validate expected results
…tests for shared string deduplication and round-trip validation
- Replaced direct comparisons with Brt.EndSheetData in XlsbReader.Enumerator.cs with a new method IsEndSheetData for clarity.
- Improved code maintainability by encapsulating the logic for checking end of sheet data.

Enhance BiffRecord and BiffRecordWriter with additional record types

- Added constants for new BIFF records in BiffRecord.cs.
- Implemented methods to write new BIFF records such as InterfaceHdr, Mms, InterfaceEnd, WriteAccess, and others in BiffRecordWriter.cs.
- Updated WriteXf method to handle style and cell XF records more effectively.

Update BiffStringEncoder to improve character validation logic

- Refactored character validation in BiffStringEncoder.cs to use pattern matching for better readability.

Modify OleCompoundWriter to handle directory entries correctly

- Changed child references in directory entries to NoStream constant for better clarity in OleCompoundWriter.cs.

Revise SharedStringTable to ensure SST records are correctly written

- Updated SharedStringTable.cs to write BeginSst and EndSst records around shared string items.

Adjust XlsGlobals to include new record writing methods

- Enhanced XlsGlobals.cs to write additional records for workbook properties and styles.

Refactor XlsSheetWriter and XlsWorkbookWriter for improved structure

- Updated XlsSheetWriter.cs to include worksheet view and metadata writing.
- Modified XlsWorkbookWriter.cs to ensure proper writing of app properties and relationships.

Add tests for new functionality in ExcelWriter

- Implemented tests in RealWorldInteropTests.cs and WriterSharedStringTests.cs to validate new record writing and structure.
- Ensured that XlsbWriter emits correct record envelopes and handles shared strings appropriately.
…improved readability; enhance WriterSharedStringTests with additional assertions for record lengths
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 97.47899% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.99%. Comparing base (4e372e8) to head (7977451).

Files with missing lines Patch % Lines
src/ExcelReader.Core/Writer/XlsbSheetWriter.cs 93.75% 3 Missing and 1 partial ⚠️
src/ExcelReader.Core/Writer/XlsbRowWriter.cs 75.00% 2 Missing and 1 partial ⚠️
...c/ExcelReader.Core/Reader/XlsbReader.Enumerator.cs 80.00% 0 Missing and 1 partial ⚠️
...elReader.Core/Writer/Internal/SharedStringTable.cs 97.67% 0 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #14      +/-   ##
==========================================
+ Coverage   85.99%   90.99%   +5.00%     
==========================================
  Files          60       61       +1     
  Lines        3862     4166     +304     
  Branches      692      710      +18     
==========================================
+ Hits         3321     3791     +470     
+ Misses        382      224     -158     
+ Partials      159      151       -8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown

Benchmark Results

Measured on ubuntu-latest (GitHub Actions). Runner noise may affect absolute numbers; use these for relative comparisons within a PR.

ExcelReader.Benchmarks.ParseBenchmark


BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.301
  [Host]     : .NET 10.0.9 (10.0.9, 10.0.926.27113), X64 RyuJIT x86-64-v3
  Job-MEHJPP : .NET 10.0.9 (10.0.9, 10.0.926.27113), X64 RyuJIT x86-64-v3

IterationCount=5  WarmupCount=1  

Method Rows Mean Error StdDev Ratio RatioSD Gen0 Allocated Alloc Ratio
ExcelParserSync 50000 29.93 ms 0.172 ms 0.045 ms 1.00 0.00 218.7500 3.88 MB 1.00
ExcelParserAsync 50000 32.52 ms 0.171 ms 0.027 ms 1.09 0.00 187.5000 3.88 MB 1.00
ExcelParserXlsbSync 50000 13.31 ms 0.090 ms 0.014 ms 0.44 0.00 234.3750 3.88 MB 1.00
ExcelParserXlsbAsync 50000 15.76 ms 0.206 ms 0.032 ms 0.53 0.00 218.7500 3.88 MB 1.00
MiniExcel 50000 241.29 ms 6.657 ms 1.729 ms 8.06 0.05 12000.0000 199.31 MB 51.42
Sylvan 50000 91.86 ms 6.528 ms 1.695 ms 3.07 0.05 - 10.47 MB 2.70
SylvanAsync 50000 95.65 ms 2.830 ms 0.438 ms 3.20 0.01 - 10.48 MB 2.70

ExcelReader.Benchmarks.ReadBenchmark


BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.301
  [Host]     : .NET 10.0.9 (10.0.9, 10.0.926.27113), X64 RyuJIT x86-64-v3
  Job-MEHJPP : .NET 10.0.9 (10.0.9, 10.0.926.27113), X64 RyuJIT x86-64-v3

IterationCount=5  WarmupCount=1  

Method Rows Mean Error StdDev Ratio RatioSD Gen0 Allocated Alloc Ratio
ExcelReader 50000 27.112 ms 0.1287 ms 0.0334 ms 1.00 0.00 - 14.07 KB 1.00
ExcelReaderAsync 50000 27.811 ms 0.4011 ms 0.1042 ms 1.03 0.00 - 16.09 KB 1.14
ExcelReaderXlsb 50000 5.967 ms 0.0594 ms 0.0092 ms 0.22 0.00 - 15.83 KB 1.12
ExcelReaderXlsbAsync 50000 6.984 ms 0.0682 ms 0.0106 ms 0.26 0.00 - 18.27 KB 1.30
MiniExcel 50000 237.616 ms 4.8272 ms 1.2536 ms 8.76 0.04 13000.0000 215590.56 KB 15,322.37
Sylvan 50000 61.086 ms 4.1160 ms 1.0689 ms 2.25 0.04 - 1938.91 KB 137.80

ExcelReader.Benchmarks.WriteBenchmark


BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.301
  [Host]     : .NET 10.0.9 (10.0.9, 10.0.926.27113), X64 RyuJIT x86-64-v3
  Job-MEHJPP : .NET 10.0.9 (10.0.9, 10.0.926.27113), X64 RyuJIT x86-64-v3

IterationCount=5  WarmupCount=1  

Method Rows Mean Error StdDev Ratio RatioSD Gen0 Gen1 Gen2 Allocated Alloc Ratio
ExcelReaderWriter 50000 23.58 ms 0.256 ms 0.066 ms 1.00 0.00 375.0000 375.0000 375.0000 2.11 MB 1.00
ExcelReaderWriterSharedStrings 50000 23.24 ms 0.833 ms 0.129 ms 0.99 0.01 375.0000 375.0000 375.0000 2.12 MB 1.00
ExcelReaderXlsbWriter 50000 13.96 ms 0.563 ms 0.146 ms 0.59 0.01 62.5000 62.5000 62.5000 2.04 MB 0.97
ExcelReaderXlsbWriterSharedStrings 50000 13.38 ms 0.616 ms 0.160 ms 0.57 0.01 62.5000 62.5000 62.5000 2.05 MB 0.97
MiniExcel 50000 106.18 ms 8.256 ms 2.144 ms 4.50 0.08 6000.0000 2000.0000 2000.0000 85.14 MB 40.41
SpreadCheetah 50000 20.17 ms 0.407 ms 0.106 ms 0.86 0.00 1093.7500 468.7500 468.7500 12.32 MB 5.85

ExcelReader.Benchmarks.XlsReadBenchmark


BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.301
  [Host]     : .NET 10.0.9 (10.0.9, 10.0.926.27113), X64 RyuJIT x86-64-v3
  Job-MEHJPP : .NET 10.0.9 (10.0.9, 10.0.926.27113), X64 RyuJIT x86-64-v3

IterationCount=5  WarmupCount=1  

Method Rows Mean Error StdDev Ratio Gen0 Gen1 Allocated Alloc Ratio
ExcelReader 50000 6.654 ms 0.0600 ms 0.0093 ms 1.00 - - 59.21 KB 1.00
ExcelReaderAsync 50000 6.642 ms 0.0328 ms 0.0085 ms 1.00 - - 59.28 KB 1.00
Sylvan 50000 8.621 ms 0.0711 ms 0.0110 ms 1.30 93.7500 46.8750 1717.73 KB 29.01

ExcelReader.Benchmarks.XlsWriteBenchmark


BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 9V74 2.60GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.301
  [Host]     : .NET 10.0.9 (10.0.9, 10.0.926.27113), X64 RyuJIT x86-64-v4
  Job-MEHJPP : .NET 10.0.9 (10.0.9, 10.0.926.27113), X64 RyuJIT x86-64-v4

IterationCount=5  WarmupCount=1  

Method Rows Mean Error StdDev Ratio Gen0 Gen1 Gen2 Allocated Alloc Ratio
XlsWriter 50000 7.047 ms 0.1508 ms 0.0392 ms 1.00 585.9375 460.9375 460.9375 12.37 MB 1.00
XlsxWriter 50000 17.091 ms 0.0247 ms 0.0038 ms 2.43 375.0000 375.0000 375.0000 2.11 MB 0.17

@GabrielMarquezMatte GabrielMarquezMatte merged commit 2619ccd into master Jun 28, 2026
12 checks passed
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.

3 participants