[PR #27] Changed the order of detecting whether the archive is in .rar format. #796

Open
opened 2026-01-29 22:17:37 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/adamhathcock/sharpcompress/pull/27

State: closed
Merged: Yes


Detecting whether the archive is in .rar format currently requires reading entire archive byte by byte
which is very slow when the archive is big and as it's done before checking for .tar and .7z formats, so the opening of archive is very slow even for those formats.

Because of this I have reordered the checks, so that detecting if this is RAR archive is done last, so that .tar and .7z formats can be loaded fast and entire archive checking will only occur when the archive is in unsupported format.

I'm not sure whether the checking of entire archive is required for RAR format, so I didn't touch it.

**Original Pull Request:** https://github.com/adamhathcock/sharpcompress/pull/27 **State:** closed **Merged:** Yes --- Detecting whether the archive is in .rar format currently requires reading entire archive byte by byte which is very slow when the archive is big and as it's done before checking for .tar and .7z formats, so the opening of archive is very slow even for those formats. Because of this I have reordered the checks, so that detecting if this is RAR archive is done last, so that .tar and .7z formats can be loaded fast and entire archive checking will only occur when the archive is in unsupported format. I'm not sure whether the checking of entire archive is required for RAR format, so I didn't touch it.
claunia added the pull-request label 2026-01-29 22:17:37 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#796