Dreamacro:erofs-rs 基准显示多种压缩与大规模文件场景领先 erofs-utils

Dreamacro 发布 erofs-rs 与 erofs-utils 1.9.4 的基准:单线程、热页缓存、3 次中位数,覆盖单文件、随机文件、10 万小文件和 Linux 7.3-rc5 源码树;在这些设置下,LZ4、DEFLATE、LZMA、Zstd 的 wall time 与峰值 RSS 多数优于 erofs-utils,同时给出镜像大小对比和完整测试限制。

作者原文

This is the result of my current benchmark:

Benchmark: erofs-rs e16d60d vs erofs-utils 1.9.4

Setup

  • erofs-rs e16d60d (Rust 1.92.0, release profile) vs erofs-utils v1.9.4-40-g27a171f (GCC -O3, --workers=1).
  • Single worker pinned to one vCPU, warm page cache, median of 3 runs.
  • 4 KiB blocks and pclusters, 64 KiB max extent, extended inodes, Compact indexes.
  • No tail packing, no fragments, no dedupe, no directory compression.
  • Codecs: LZ4 (fast), DEFLATE level 6, MicroLZMA preset 1, Zstd level 1.
  • Datasets:
  • one 256 MiB file built from Linux .c/.h sources;
  • one 256 MiB random file;
  • 100,000 small files (128 B to 8 KiB, ~75% text, ~25% random);
  • the full Linux 7.3-rc5 source tree (e767a4ea, 95,951 files, ~1.53 GiB, no .git).

Each cell: wall s / CPU s (user+sys) / peak RSS MiB

256 MiB source-like file

| Mode | erofs-rs | erofs-utils | Speedup |
|---|---:|---:|---:|
| none | 0.233 / 0.23 / 5.3 | 0.234 / 0.23 / 4.3 | 1.00× |
| lz4 | 0.435 / 0.43 / 5.6 | 0.485 / 0.47 / 83.7 | 1.12× |
| deflate | 3.055 / 3.04 / 5.6 | 3.536 / 3.53 / 54.6 | 1.16× |
| lzma | 4.488 / 4.47 / 6.1 | 7.881 / 7.86 / 54.2 | 1.76× |
| zstd | 2.279 / 2.27 / 6.4 | 3.325 / 3.31 / 59.7 | 1.46× |

256 MiB random file

| Mode | erofs-rs | erofs-utils | Speedup |
|---|---:|---:|---:|
| none | 0.230 / 0.22 / 5.4 | 0.230 / 0.22 / 4.3 | 1.00× |
| lz4 | 0.378 / 0.37 / 5.7 | 0.730 / 0.72 / 197.9 | 1.93× |
| deflate | 2.700 / 2.69 / 5.6 | 3.547 / 3.53 / 191.3 | 1.31× |
| lzma | 15.342 / 15.32 / 6.0 | 31.534 / 31.51 / 190.7 | 2.06× |
| zstd | 0.768 / 0.76 / 5.9 | 1.631 / 1.62 / 192.4 | 2.12× |

100,000 small files

| Mode | erofs-rs | erofs-utils | Speedup |
|---|---:|---:|---:|
| none | 1.375 / 1.36 / 80.3 | 1.866 / 1.79 / 118.2 | 1.36× |
| lz4 | 1.597 / 1.59 / 80.7 | 2.498 / 2.48 / 118.2 | 1.56× |
| deflate | 2.691 / 2.68 / 81.1 | 4.990 / 4.98 / 119.0 | 1.85× |
| lzma | 5.062 / 5.05 / 81.8 | 11.074 / 11.06 / 119.3 | 2.19× |
| zstd | 1.739 / 1.72 / 81.6 | 2.703 / 2.69 / 119.1 | 1.55× |

Linux source tree

| Mode | erofs-rs | erofs-utils | Speedup |
|---|---:|---:|---:|
| none | 2.767 / 2.74 / 91.8 | 3.448 / 3.38 / 224.3 | 1.25× |
| lz4 | 3.890 / 3.87 / 91.8 | 5.154 / 5.15 / 158.1 | 1.32× |
| deflate | 18.317 / 18.30 / 92.1 | 23.485 / 23.47 / 151.8 | 1.28× |
| lzma | 27.300 / 27.28 / 92.6 | 49.415 / 49.39 / 152.3 | 1.81× |
| zstd | 12.269 / 12.25 / 92.7 | 17.761 / 17.74 / 153.7 | 1.45× |

Image size (MiB, erofs-rs / erofs-utils)

| Dataset | none | lz4 | deflate | lzma | zstd |
|---|---:|---:|---:|---:|---:|
| 256 MiB source-like | 256.01 / 256.00 | 83.71 / 84.55 | 48.66 / 49.17 | 47.68 / 47.71 | 58.50 / 54.38 |
| 256 MiB random | 256.01 / 256.00 | 256.13 / 256.00 | 256.13 / 256.00 | 256.13 / 256.00 | 256.13 / 256.00 |
| 100,000 small files | 262.37 / 262.37 | 239.24 / 238.71 | 214.15 / 213.81 | 214.15 / 213.81 | 216.37 / 213.81 |
| Linux source tree | 1576.15 / 1576.17 | 650.95 / 652.66 | 454.29 / 456.80 | 451.21 / 451.11 | 509.62 / 485.99 |