Evidence type: hands_on. Results are limited to the documented conditions.

Introduction

Why can one file shrink to one twentieth of its size while another grows? Lossless compression represents predictable or repeated information more compactly without discarding it [1–4]. Yet a pattern may exist without being accessible to a particular compressor. Using 7-Zip, we examine whether structure matters, whether algorithms can exploit it, and whether additional computation is worthwhile. This is an empirical study, not a new compression theory.

Results

Identical bytes, different outcomes

Would shuffling the bytes of a book while preserving their counts change its compressed size? We constructed five arrangements of an 8 MiB English text. The original saved 72.1% of its space, byte-wise shuffling reduced savings to 40.5%, and sorting bytes increased savings to 99.98% (Fig. 1). Byte frequencies were identical; sequence structure differed. Block shuffling preserved local patterns and produced results close to the original. Controlled Markov-chain experiments provide complementary evidence (Extended Data Fig. 2). Byte frequencies alone therefore do not describe compressibility adequately.

Figure 1 | Identical byte counts, different arrangements. a, illustrative sequences with equal symbol counts; b, measured LZMA2 level-9 savings for five arrangements of an 8 MiB text.Figure 1 | Identical byte counts, different arrangements. a, illustrative sequences with equal symbol counts; b, measured LZMA2 level-9 savings for five arrangements of an 8 MiB text.

Patterns can exist beyond an algorithm’s reach

Why might a compressor fail to exploit repeated information? We repeated random blocks to fill 8 MiB, varying block length. At intervals of 64 KiB and above, Deflate achieved virtually no savings; LZMA2 still saved 74.98% at 2 MiB (Fig. 2). This is consistent with different matching ranges. With a single random 8 MiB block, both archives grew slightly.

Real large files also differed in sensitivity to settings. A Japanese dictionary matrix saved 18.45% at level 1 and 48.43% at level 9, whereas the Ubuntu index already saved 94.89% at level 1. At fixed level 9, expanding the Ubuntu index dictionary from 8 to 256 MiB added only 0.04 percentage points. The matrix’s 128 and 256 MiB configurations correspond to levels 7 and 9; their difference cannot be attributed solely to dictionary size, and its repeat distances were not measured directly.

Figure 2 | Algorithmic reach. a, conceptual dictionary window; b, repeated random blocks at level 9; c, level responses of four large files; d, Ubuntu index dictionary comparison at fixed level 9.Figure 2 | Algorithmic reach. a, conceptual dictionary window; b, repeated random blocks at level 9; c, level responses of four large files; d, Ubuntu index dictionary comparison at fixed level 9.

Is additional search worth its cost?

Exploiting more patterns does not necessarily justify additional computation. Across 23 corpus files, moving from LZMA2 level 1 to 5 yielded a median additional 3.02 percentage points and a median per-file time ratio of 4.87. Moving from 5 to 9 yielded only 0.04 points (95% bootstrap confidence interval 0.02–0.20), with a time ratio of 1.08 (Fig. 3). Some files even showed negative gains. In contrast, the dictionary matrix gained about 3.67 points from level 7 to 9. Marginal benefit depends on the data, not just the setting.

Figure 3 | Marginal gains and time cost. a,b, paired differences for 23 files, medians and 95% bootstrap confidence intervals (different horizontal scales); c, median per-file compression-time ratios.Figure 3 | Marginal gains and time cost. a,b, paired differences for 23 files, medians and 95% bootstrap confidence intervals (different horizontal scales); c, median per-file compression-time ratios.

Real files: how much structure remains?

These mechanisms offer clues to differences among real files. Across 70 files, median savings were 81.5% for CSV/JSON but 0.13% for JPEG; PNG grew slightly. Even PDFs varied widely (Fig. 4). Existing encodings often exploit some structure already, but an extension cannot directly measure remaining redundancy.

Storage representation also matters. Lossless WebP occupied 27.1% of the raw pixel reference, versus 41.7% for direct 7z compression. FLAC occupied 38.6% of the WAV reference, versus 81.0% after 7z compression. These are comparisons of specific samples, not proof of universal format superiority.

Figure 4 | Real files and encoding. a, individual measurements for 70 files and category medians; b, three matched-content lossless storage comparisons relative to their uncompressed references. Photo and music were decoded from lossy files; losslessness refers to the decoded data.Figure 4 | Real files and encoding. a, individual measurements for 70 files and category medians; b, three matched-content lossless storage comparisons relative to their uncompressed references. Photo and music were decoded from lossy files; losslessness refers to the decoded data.

Discussion and conclusions

From byte rearrangement to repeated-block experiments, the evidence distinguishes structure present in data from structure accessible to a compressor. Greater search capability may improve savings, but contrasting corpus and large-file results show that its value depends on the data. Existing encoding further changes the remaining compressible structure.

The boundaries matter: only five real files per category and four large files were tested. The matrix lacks an isolated dictionary-size comparison, and distant repetitions were not measured directly. Absolute speeds reflect a two-vCPU VM and a build without optional assembler optimization. GB-scale video, Zstandard, encryption and split archives were not tested; photo, music and video format tests used decoded lossy inputs. Findings cannot be generalized to all files or hardware.

Rather than identify a universally optimal compression level, we propose an evidence-based approach: understand data structure and prior encoding, measure the additional benefit available to the algorithm, and weigh storage against time and memory. Understanding the data matters more than simply maximizing the compression level.

Materials and methods

Environment. 7-Zip 26.06 (official source commit d3296e39, GCC 13.3, without optional assembly optimizations), with 23.01 as a version comparison; Ubuntu 24.04.5 VM, 2 vCPUs and 7.8 GiB RAM. Tests on 2026-12-01 used warm caches; A–D and verification used tmpfs, large files used disk.

Samples and design. The Silesia and Canterbury corpora supplied 23 files [5,6]. Seventy real files covered 14 categories, five per category, with 13 overlapping the corpora. Additional samples comprised 25 controlled 8 MiB files, 41 format variants of seven source contents, and four large Ubuntu repository files. Default 7z, xz, bzip2, zip and gzip were compared. Controlled method tests used a 7z container, one thread and no filters, comparing LZMA2, LZMA, PPMd, BZip2 and Deflate at levels 1/3/5/7/9. Additional tests varied threading, solid mode, filters and versions; rearranged bytes, generated repeated blocks and Markov chains, and varied large-file dictionaries. Actual settings were checked with 7zz l -slt [7].

Measurements and statistics. Space saving = 1 − archive bytes / original bytes; negative values indicate growth. Time, CPU time, throughput, peak resident memory and SHA-256 were recorded. Files were independent units; technical repetitions (normally three) were randomized. Paired Wilcoxon tests and bootstrap 95% confidence intervals for median differences were used on 23 corpus files; structural associations used Spearman correlations. H0 describes byte frequencies, H1 first-order conditional entropy and R32 repeated 32-byte segments. The four large files were analysed descriptively because some settings had fewer repeats owing to runtime costs.

Extended results and data

Figure S1. Measured data: a, size-weighted overall saving; b, compression throughput; c, extraction throughput for five methods × five levels on the 23 standard corpus files (one thread, filters off).Figure S1. Measured data: a, size-weighted overall saving; b, compression throughput; c, extraction throughput for five methods × five levels on the 23 standard corpus files (one thread, filters off).

PPMd -mx9 achieved the highest weighted saving (77.53%), but extracted at only 4.8 MB/s versus about 70 MB/s for LZMA2. For compression, transmission and extraction combined, PPMd -mx5 was best at 1 Mbit/s, Deflate -mx1 at 100 Mbit/s, and uncompressed transfer at 1 Gbit/s. These choices depend on the test machine.

Re-testing 80 files confirmed byte-identical archives for LZMA/LZMA2 levels 7 and 9 and Deflate levels 1 and 3 (80/80 in each comparison). This does not make ultra universally redundant: the result depends on samples and settings.

For the 70 real files, H0 correlated with saving at −0.91. Restricting analysis to 40 text and uncompressed binary files reduced this to −0.69; R32 correlated at 0.84 and H1 at −0.80. The order-0 reference 1−H0/8 is not a universal limit. In 16-symbol Markov chains, H0 remained four bits, but increasing context dependence raised LZMA2 savings from 47.2% to 97.8%, approaching the corresponding entropy-rate bounds.

Figure S2. Measured data. a, order-0 byte entropy H0 against space saving (LZMA2 -mx9, 80 real and corpus files); the dashed line is the order-0 reference 1 − H0/8, which is not a compression limit. b, R32 against saving. c, controlled data: the x-axis is the theoretical entropy rate of the generating model, and the dashed line is 1 − H/8. Labels on the Markov chains give the observed frequency of "next = previous + 1".Figure S2. Measured data. a, order-0 byte entropy H0 against space saving (LZMA2 -mx9, 80 real and corpus files); the dashed line is the order-0 reference 1 − H0/8, which is not a compression limit. b, R32 against saving. c, controlled data: the x-axis is the theoretical entropy rate of the generating model, and the dashed line is 1 − H/8. Labels on the Markov chains give the observed frequency of ”next = previous + 1”.

The 4,936 initial formal runs, 63 pilot runs, 480 re-tests and 36 large-file runs totalled 5,515. The source study reports all formal runs succeeded and extracted-file SHA-256 hashes matched. Negative savings occurred in 407 initial formal runs and 50 later runs, all retained. Across 925 groups with at least three repetitions, compression-time CV for files over 1 MB had a median of 7.9% (90th percentile 17.4%). Large-file tests comprised 31 level runs and five dictionary runs; some settings were measured only once, precluding fine speed comparisons.

Data and code availability

The separately supplied research archive (RESEARCH_ARCHIVE_7ZIP_V13.zip) contains the following. Historical rendered figures are omitted; raw data and plotting scripts are retained:

  • every raw run record from V1 and V2, one row per run, never edited or deleted;
  • the re-test and GB-scale records;
  • the analysis tables and structure measures;
  • the scripts for fetching, generating, measuring, statistics and plotting;
  • the environment record, full commands, data sources with licences and SHA-256 lists;
  • the V1 → V2 change log and the final audit report.

Third-party data files are not included; for some files the list records only the source project, not an explicit licence, and ESC-50 is CC BY-NC 3.0. They can be fetched again at pinned versions with fetch_real_files.py and prepare_E.py and checked by SHA-256. The 7-Zip source came from https://github.com/ip7z/7zip.

Author contributions

The research questions, experimental requirements and evaluation criteria were set by the ZIRULAB author in a research task specification. Data collection, building 7-Zip, running the experiments, statistical analysis, plotting and the drafts in three languages were carried out with AI tools within that specification. Every number can be reproduced from the scripts and raw records in the archive. The named author reviews the final published content and takes responsibility for it.