Skip to content

Improve memory efficiency in file reading and add tests#14

Merged
kewmine merged 2 commits into
clickswave:mainfrom
vschwaberow:changes
Apr 10, 2025
Merged

Improve memory efficiency in file reading and add tests#14
kewmine merged 2 commits into
clickswave:mainfrom
vschwaberow:changes

Conversation

@vschwaberow
Copy link
Copy Markdown
Contributor

Refactor the file reading implementation to use a line-by-line buffered approach, enhancing memory efficiency for large files. Add comprehensive tests for the file read and hash functions to ensure robustness.

- Replaced the previous file reading implementation which loaded the
entire file into memory (causing potential OOM errors on large files)
with a line-by-line buffered approach.

- The new implementation uses `tokio::fs::File`, `tokio::io::BufReader`,
and `reader.lines()` to read the file incrementally. This drastically
reduces peak memory usage, especially for large input files, making
the function more robust.
@kewmine
Copy link
Copy Markdown
Member

kewmine commented Apr 10, 2025

It looks good! Thank you for the PR.

@kewmine kewmine closed this Apr 10, 2025
@kewmine kewmine reopened this Apr 10, 2025
@kewmine kewmine merged commit 66d2e5c into clickswave:main Apr 10, 2025
0 of 3 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.

2 participants