Skip to content

Conversation

@DeyV
Copy link
Contributor

@DeyV DeyV commented Sep 26, 2025

fix [#35]

…d cell store for handling large files, effectively limiting memory usage.

This change follows the guidance of using the `xlsx` library's built-in `UseDiskVCellStore` feature. When the `--max-memory` flag is present, the application will now use temporary files on disk to store cell data, which significantly reduces the memory footprint when processing large CSV files.

The development process involved several iterations to arrive at this correct solution, which leverages the library's intended functionality for handling large datasets.

Key changes:
- Added a `--max-memory` boolean flag to `command_line.go`.
- Modified `write.go` to conditionally use `xlsx.UseDiskVCellStore` when creating or opening an XLSX file if the `--max-memory` flag is set.
- Added a new test case in `main_test.go` to validate that large files can be processed successfully with this option enabled. The test programmatically creates the test data.
- Added the generated test file `dummy_large.csv` to `.gitignore`.
- Updated `README.md` to document the new flag.
… cell store for handling large files, effectively limiting memory usage.

This change follows the guidance of using the `xlsx` library's built-in `UseDiskVCellStore` feature. When the `--use-cache` flag is present, the application will now use temporary files on disk to store cell data, which significantly reduces the memory footprint when processing large CSV files. The flag was renamed from `--max-memory` to `--use-cache` to more accurately reflect its function.

Key changes:
- Renamed the `--max-memory` flag to `--use-cache` in `command_line.go`.
- Modified `write.go` to conditionally use `xlsx.UseDiskVCellStore` when the `--use-cache` flag is set.
- Updated tests in `main_test.go` to use the new flag and test the disk-based storage functionality.
- Added benchmark tests (`BenchmarkBuildXls_InMemory` and `BenchmarkBuildXls_DiskV`) to compare the in-memory and disk-based storage solutions.
- Added generated test files to `.gitignore` to keep the repository clean.
- Updated `README.md` to document the new `--use-cache` flag.
@DeyV DeyV merged commit 5453337 into master Sep 26, 2025
1 check 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.

2 participants