Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Chrysaloid/d9fd78a367541c4e1b74fc3577e1c7dc to your computer and use it in GitHub Desktop.

Select an option

Save Chrysaloid/d9fd78a367541c4e1b74fc3577e1c7dc to your computer and use it in GitHub Desktop.
An export (with the use of this https://chromewebstore.google.com/detail/chatgpt-to-markdown-pro-c/adghjpdmpbcmppeafpodcjpagmegdpci Chrome extension) and an edit (with the use of this https://gist.github.com/Chrysaloid/96939fba99232145ab6d41f06cf34be6 Python script) of my small conversation with ChatGPT

🙂You:🙂 Compare popular compression formats like zip, 7zip, tar.gz, xz, rar in a tabular way

✨ChatGPT:✨ Here’s a clear side-by-side comparison of the most popular compression/archive formats:

Format Type Compression Ratio Speed (Compress/Decompress) Supports Splitting Encryption Open Source Common Use Cases
ZIP Archive + Compression ⭐⭐ (Moderate) ⭐⭐⭐⭐ / ⭐⭐⭐⭐ (Fast) Yes Yes (weak AES support varies) Yes General use, Windows default, sharing files
7z (7-Zip) Archive + Compression ⭐⭐⭐⭐ (High) ⭐⭐ / ⭐⭐⭐ (Slow compress, decent extract) Yes Yes (strong AES-256) Yes Maximum compression, backups
tar.gz Archive (tar) + Compression (gzip) ⭐⭐⭐ (Good) ⭐⭐⭐ / ⭐⭐⭐⭐ (Balanced) Limited (via tools) No (by default) Yes Linux/Unix distributions, source code
tar.xz Archive + Compression (xz) ⭐⭐⭐⭐⭐ (Very high) ⭐ / ⭐⭐ (Slow) Limited No (by default) Yes Long-term storage, Linux packages
RAR Archive + Compression ⭐⭐⭐⭐ (High) ⭐⭐⭐ / ⭐⭐⭐ (Balanced) Yes Yes (strong AES-256) ❌ (proprietary) Commercial use, large archives, recovery features

Key Takeaways

  • Best compatibility:ZIP (works everywhere out of the box)
  • Best compression ratio:tar.xz (smallest files, but slow) → 7z is a strong alternative with better usability
  • Best balance (speed vs size):tar.gz (especially common on Linux)
  • Best features (recovery, splitting, encryption):RAR (but it’s proprietary)
  • Best open-source advanced option:7z

Extra Notes

  • tar.gz / tar.xz are actually two-step formats:
    • tar = bundles files (no compression)
    • gzip / xz = compresses the bundle
  • 7z vs RAR:
    • 7z = free & open, slightly better compression
    • RAR = better recovery tools and ecosystem support

If you want, I can recommend the best format for your specific use case (e.g., backups, sharing, game mods, etc.).

🙂You:🙂 Which of those support listing the archive file tree and what is the cost of getting the listing out of the archive? Update the table. Use N⭐ notation for Compression Ratio and Speed

✨ChatGPT:✨ Here’s an updated comparison including file tree listing support and the cost of extracting that listing (i.e., how much of the archive must be read/decompressed to show contents):

Format Type Compression Ratio Speed (Compress / Decompress) Supports Listing Listing Cost Supports Splitting Encryption Open Source Common Use Cases
ZIP Archive + Compression 2⭐ 4⭐ / 4⭐ Yes 1⭐ (Central directory at end; very fast) Yes Yes (AES varies) Yes General use, Windows default
7z (7-Zip) Archive + Compression 4⭐ 2⭐ / 3⭐ Yes 2–3⭐ (Metadata compressed; may need partial decode) Yes Yes (AES-256) Yes High compression backups
tar.gz Archive + Compression 3⭐ 3⭐ / 4⭐ Yes 5⭐ (Must scan sequentially through archive) Limited No (by default) Yes Linux distributions
tar.xz Archive + Compression 5⭐ 1⭐ / 2⭐ Yes 5⭐ (Slow sequential scan + heavy decompression) Limited No (by default) Yes Long-term storage
RAR Archive + Compression 4⭐ 3⭐ / 3⭐ Yes 2⭐ (Has index, but may need partial processing) Yes Yes (AES-256) Large archives, recovery

How to Interpret “Listing Cost”

  • 1⭐ (Best / Lowest cost) → Instant listing using metadata index (no decompression needed) → Example: ZIP reads the central directory
  • 2–3⭐ (Moderate) → Some metadata is compressed → partial decompression required → Still relatively fast
  • 5⭐ (Worst / Highest cost) → No index → must scan entire archive sequentially → Potentially very slow on large files

Key Insights

  • Fastest listing by far:ZIP (designed with a central directory)
  • Worst for listing:tar.gz / tar.xz (no index at all)
  • Best balance:RAR and 7z (indexed but compressed metadata)

Practical Implications

  • If you frequently browse archive contents without extracting: → Prefer ZIP, RAR, or 7z
  • If you only extract everything anyway: → tar.gz or tar.xz are perfectly fine
  • For huge archives (tens of GB+): → Avoid tar-based formats if you need quick listing or random access

If you want, I can also compare random file extraction cost (not just listing), which differs quite a bit between these formats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment