mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-12 05:25:03 +00:00
[PR #1160] add check to see if we need to seek before hand #1597
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/adamhathcock/sharpcompress/pull/1160
State: closed
Merged: Yes
Related to findings on https://github.com/adamhathcock/sharpcompress/issues/1105 by @julianxhokaxhiu
This pull request improves memory efficiency and stream handling in
BufferedSubStreamby using pooled buffers and optimizing seek operations. It also updates the test suite to better simulate forward-only stream scenarios.Memory Management Improvements:
_cacheallocation inBufferedSubStreamto useArrayPool<byte>.Shared.Rentfor buffer pooling, and ensured the buffer is returned to the pool inDisposefor reduced GC pressure. [1] [2]Performance and Stream Handling Enhancements:
RefillCacheandRefillCacheAsyncto avoid unnecessary seek operations by checking the current stream position before seeking, improving performance for sequential reads. [1] [2]Testing Improvements:
BufferReadAndSeekTestto wrap the memory stream withForwardOnlyStream, better simulating streams that do not support seeking. [1] [2]