Commit Graph

150 Commits

Author SHA1 Message Date
Adam Hathcock
ed29acda67 Remove redundant partial modifiers 2026-10-21 09:53:07 +01:00
Adam Hathcock
2463488de7 Merge remote-tracking branch 'origin/master' into feature/non-seekable-zip64-writing
# Conflicts:
#	src/SharpCompress/Factories/TarFactory.cs
#	src/SharpCompress/Readers/Tar/TarReader.Factory.cs
#	src/SharpCompress/Readers/Tar/TarReader.cs
#	tests/SharpCompress.Test/Streams/RarLifetimeTests.cs
#	tests/SharpCompress.Test/Streams/SevenZipLifetimeTests.cs
#	tests/SharpCompress.Test/Streams/TarLifetimeTests.cs
2026-10-20 11:41:45 +01:00
Adam Hathcock
bae154799d Merge pull request #1461 from adamhathcock/perf/zip-profile-pooling
Reduce Deflate read and Huffman scratch allocations
2026-10-20 11:05:49 +01:00
Adam Hathcock
c78cc86e04 Avoid temporary allocations in ring-buffered async reads 2026-10-20 10:52:15 +01:00
Adam Hathcock
7731843e25 Reduce Deflate read and Huffman scratch allocations
Use a ValueTask read core and memory-based compressed-input refills on modern targets, replace per-block Huffman output arrays with scalar parameters, and decode directly into array-backed caller memory with a pooled fallback.

Preserve generated sync array-read semantics and clear codec output references after reads. Add slice, fallback, cancellation, failure, tree-validation, and read-ahead coverage; document staged ZIP profiles.

Validation: 2,989 .NET 10 tests passed; all library targets, net48 tests, and performance project compile; formatting checks pass.
2026-10-20 09:56:54 +01:00
Adam Hathcock
1ad052edcc Merge remote-tracking branch 'origin/master' into perf/7zip-profile-pooling
# Conflicts:
#	src/SharpCompress/Compressors/LZMA/Lzma2EncoderStream.cs
#	src/SharpCompress/Compressors/LZMA/LzmaStream.Async.cs
#	src/SharpCompress/IO/ReadOnlyMemoryStream.cs
2026-10-20 08:31:32 +01:00
Adam Hathcock
f41cc208cc Pool LZMA workspaces and streamline 7z metadata writing
Reuse LZMA2 trial decoders and pooled compressed output, pool and consolidate decoder probability banks, lazily rent encoder optimization scratch, and avoid copying direct async memory writes.

Use bounded stack scratch and stream 7z metadata without temporary property buffers. Add ownership, failure, context-shrink, Unicode, and block-boundary regressions.

Document allocation profiles, the small-file LZMA2 throughput tradeoff, and rejection of exact-size match-finder arrays. Validation: 3,016 .NET 10 tests passed; all library targets, net48 tests, and performance project compile; formatting checks pass.
2026-10-20 08:28:23 +01:00
Adam Hathcock
030569611e Reduce 7z copy and LZMA decoder allocations
Pool writer CRC-copy buffers, use memory-based async read overloads on modern targets, reuse LZMA2 decoders across resets, and initialize probability-model banks lazily.

Add reset/property-change, memory-read, writer boundary/CRC, and growth regression coverage. Document staged profiling results and rejection of dictionary-growth policies that regress small-file allocations.

Validation: 2,997 .NET 10 Release tests passed, all library targets built, net48 tests compiled, and formatting checks passed.
2026-10-19 15:11:47 +01:00
Adam Hathcock
14d77b671c Release pooled 7z decoder buffers across async and partial reads
Dispose cached folder decoders during async archive cleanup and scope temporary encoded-header decoders in both read paths. Release LZMA range-decoder input buffers on partial reads and failures while preserving borrowed source ownership.

Correct the synchronous extraction-reader benchmark and expand lifetime and checksum coverage. Document profiling showing async Archive allocations falling from 8.95 MiB to 0.70 MiB per extraction, with metadata-only allocations reduced by 70%.

Validation: 2,989 .NET 10 Release tests passed; all library targets, the performance project, and net48 test compilation succeeded. Formatting and whitespace checks passed.
2026-10-19 14:43:51 +01:00
Adam Hathcock
78006f94f7 More pooled or readonly memory stream usage 2026-10-19 12:07:29 +01:00
Adam Hathcock
700ae66e0a Fix usage of DisposeAsyncScope 2026-10-19 11:49:08 +01:00
Adam Hathcock
0fbf36d602 Merge remote-tracking branch 'origin/release'
# Conflicts:
#	src/SharpCompress/Compressors/LZMA/LZ/LzOutWindow.cs
#	src/SharpCompress/Compressors/LZMA/LzmaStream.cs
2026-10-19 11:15:09 +01:00
Adam Hathcock
2168385f2e fixes for release 2026-10-19 10:52:07 +01:00
Adam Hathcock
560a148ddb Merge pull request #1455 from romaklayt/perf/source-stream-cache-length
Read each SourceStream part's length once
2026-10-19 10:36:22 +01:00
Adam Hathcock
7642f76f38 changes fixes to use pooled arrays 2026-10-19 10:10:09 +01:00
Adam Hathcock
4966fc186b Merge branch 'release' into fix/lzma2-truncated-header
# Conflicts:
#	src/SharpCompress/Compressors/LZMA/LZ/LzOutWindow.cs
2026-10-19 09:59:33 +01:00
Adam Hathcock
c6d8c76b14 Review changes around disposal 2026-10-19 09:43:44 +01:00
Adam Hathcock
26d482f785 Merge remote-tracking branch 'origin/master' into feature/reduce-archive-allocations 2026-10-19 09:13:03 +01:00
Adam Hathcock
1fc4a7cdf1 Remove unsupported LZMA terminal-error guarantees 2026-10-16 16:03:00 +01:00
Adam Hathcock
a83022ca17 Preserve frozen stream recordings during TAR probing 2026-10-16 15:57:21 +01:00
Adam Hathcock
d4234a2b35 Guard LZMA CodeFast dictionary accesses 2026-10-16 15:50:17 +01:00
Adam Hathcock
2369f10b63 Grow LZMA dictionary storage only as decoded history requires 2026-10-16 15:39:56 +01:00
Adam Hathcock
bc1ade2bbc Reject truncated LZMA2 headers and prevent stalled decoding 2026-10-16 15:23:57 +01:00
Adam Hathcock
9bb74557d5 Fix TAR probe cleanup and preserve active recording sessions 2026-10-16 15:08:36 +01:00
Roma Kolyago
e7421f5daa Read each SourceStream part's length once 2026-10-16 16:04:44 +03:00
Adam Hathcock
0ef935c13c Dispose 7Zip reader decoders without closing borrowed volumes 2026-10-15 18:18:18 +01:00
Adam Hathcock
c063e45d1b Release TAR probe buffers and avoid buffering seekable inputs 2026-10-15 18:18:17 +01:00
Adam Hathcock
f5f8558de6 Fix async RAR unpacker buffer disposal 2026-10-15 18:17:49 +01:00
Adam Hathcock
0595cba0c0 more optimizing of zip/zip64 2026-10-15 18:17:49 +01:00
Adam Hathcock
3f613ab6cf deflate 0 optimizations 2026-10-15 18:17:49 +01:00
Adam Hathcock
454ec7e98b Dispose 7Zip reader decoders without closing borrowed volumes 2026-10-15 16:49:30 +01:00
Adam Hathcock
7505ba7e5f Release TAR probe buffers and avoid buffering seekable inputs 2026-10-15 16:49:30 +01:00
Adam Hathcock
77490536ae Fix async RAR unpacker buffer disposal 2026-10-15 16:48:47 +01:00
Adam Hathcock
e58fcb23e5 Preserve async disposal across all supported frameworks 2026-10-13 12:57:14 +01:00
Adam Hathcock
3bbe0cc93f Use STREAM_DISPOSEASYNC capability guards for stream disposal 2026-10-13 12:41:38 +01:00
Adam Hathcock
d431c80b38 Fix WinZip AES authentication retry after cancellation 2026-10-13 12:23:24 +01:00
Adam Hathcock
1fb8ac1724 Merge remote-tracking branch 'origin/release'
# Conflicts:
#	src/SharpCompress/Compressors/LZMA/LzmaStream.Async.cs
#	src/SharpCompress/Compressors/LZMA/LzmaStream.cs
2026-10-13 11:39:15 +01:00
Adam Hathcock
ba8d0f84b1 Merge remote-tracking branch 'origin/release'
# Conflicts:
#	src/SharpCompress/Common/GZip/GZipChecksumValidationStream.cs
#	src/SharpCompress/Common/Zip/WinzipAesCryptoStream.Async.cs
#	src/SharpCompress/Common/Zip/WinzipAesCryptoStream.cs
#	src/SharpCompress/Compressors/Deflate/ZlibBaseStream.cs
2026-10-13 11:00:17 +01:00
Adam Hathcock
b91671dfc3 Release partially constructed 7z decoder streams on failure 2026-10-13 10:31:15 +01:00
Adam Hathcock
bdb42df4dc Make raw LZMA setup and disposal exception-safe 2026-10-13 10:29:07 +01:00
Adam Hathcock
38e3222dc2 Release rewind buffers despite disposal failures and reject disposed reads 2026-10-13 10:26:09 +01:00
Adam Hathcock
b3fac7e04a Release owned Squeeze buffers and failed PPMd models 2026-10-13 10:24:19 +01:00
Adam Hathcock
46437bbbbc Return pooled memory stream blocks when construction fails 2026-10-13 10:21:45 +01:00
Adam Hathcock
b8f3a8695b Validate LZMA2 setup before renting and reject disposed writes 2026-10-13 10:09:14 +01:00
Adam Hathcock
c574364838 Fix pooled buffer ownership and exception-safe cleanup 2026-10-13 09:57:19 +01:00
Adam Hathcock
f888179583 Preserve DEFLATE read-ahead bytes after one-byte output and EOF 2026-10-10 15:40:37 +01:00
Adam Hathcock
fed1d884c7 Do not treat zero-length checksum reads as end of entry 2026-10-10 15:40:37 +01:00
Adam Hathcock
d01539ae3c Handle partial LZip headers and validate dictionary sizes consistently 2026-10-10 15:40:35 +01:00
Adam Hathcock
7265047dd7 Verify WinZip AES authentication and reject truncated encrypted data 2026-10-10 15:40:34 +01:00
Adam Hathcock
c698124896 Fixes for parallel lzma usage 2026-08-03 15:49:01 +01:00