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

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

📋 Pull Request Information

Original PR: https://github.com/adamhathcock/sharpcompress/pull/27
Author: @Strachu
Created: 12/16/2014
Status: Merged
Merged: 12/16/2014
Merged by: @adamhathcock

Base: masterHead: rar_reorder


📝 Commits (1)

  • ca2778b Changed the order of detecting whether the archive is in .rar format.

📊 Changes

1 file changed (+14 additions, -14 deletions)

View changed files

📝 SharpCompress/Archive/ArchiveFactory.cs (+14 -14)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/adamhathcock/sharpcompress/pull/27 **Author:** [@Strachu](https://github.com/Strachu) **Created:** 12/16/2014 **Status:** ✅ Merged **Merged:** 12/16/2014 **Merged by:** [@adamhathcock](https://github.com/adamhathcock) **Base:** `master` ← **Head:** `rar_reorder` --- ### 📝 Commits (1) - [`ca2778b`](https://github.com/adamhathcock/sharpcompress/commit/ca2778b65878bc50b4569e4f31bcd02991c7552d) Changed the order of detecting whether the archive is in .rar format. ### 📊 Changes **1 file changed** (+14 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `SharpCompress/Archive/ArchiveFactory.cs` (+14 -14) </details> ### 📄 Description 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 22:17:36 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#792