Show HN: misa77 - Up to 3x faster decompression than zstd, with better ratios
misa77 is an LZ-based compressor that targets the write-once, read-many niche. In particular, it aims to satisfy the following criteria: - Extremely high decompression throughput (single-threaded and in-memory). - Good compression ratios relative to decode throughput. For reference, misa77 levels that correspond to LZ4 and zstd-class ratios decode roughly 2 times faster than their counterparts. - Constant memory use during compression, regardless of input size. Slow compression is the obvious tradeoff that we make to achieve the above. Decompression is guaranteed to be safe in the case of corrupt/malicious input (i.e. the decompressor terminates gracefully, and does not access out-of-bounds memory or engage in any other UB) . A terse summary of misa77's performance would be that relative to its competitors (LZ4 class codecs for levels 1 to 6, and zstd/brotli/xz for levels 11 to 13), it encodes somewhat slower, gets similar ratios, but decodes much faster. Some results on specific corpora follow. For more detailed and cross-platform results, see BENCHMARKS.md. The benchmarks below were run on the following setup: - CPU: Intel(R) Core(TM) i7-14650HX (@2.2 GHz) (Intel Turbo disabled). - Single threaded, pinned to a single performance core. - CPU governor set to performance , uncore frequency pinned at its maximum. The benchmarking harness used was lzbench. misa77 has also been merged into TurboBench, and the results below can be reproduced through both harnesses. This corpus can be found here. It contains 12 files, totaling 212 MB, covering text, source code, databases, executables, and medical images. It is the standard (albeit outdated) corpus for comparing general-purpose compressors. The takeaway is that levels 3-6 dominate LZ4 (and other codecs in this class) on decode speed. Level 6 in particular gets smaller ratios and decodes ~2x faster (...and encodes much slower). Levels 11-13 get ratios similar to those of zstd's levels 11 to 22, while decoding about 2.5 to 3 times faster. Note: lzbench lists misa77 as two codecs, as its levels are not contiguous. misa77 is levels 1 to 6 and misa77ec is levels 11 to 13. Table: silesia.tar (Intel) | Compressor name | Compression | Decompress. | Ratio | Filename | |---|---|---|---|---| | misa77 0.9.0 -1 | 233 MB/s | 4495 MB/s | 46.74 | silesia.tar | | misa77 0.9.0 -2 | 168 MB/s | 5157 MB/s | 44.28 | silesia.tar | | misa77 0.9.0 -3 | 71.9 MB/s | 5909 MB/s | 42.59 | silesia.tar | | misa77 0.9.0 -4 | 42.9 MB/s | 5227 MB/s | 40.33 | silesia.tar | | misa77 0.9.0 -5 | 10.6 MB/s | 5160 MB/s | 37.76 | silesia.tar | | misa77 0.9.0 -6 | 1.79 MB/s | 5334 MB/s | 32.34 | silesia.tar | | misa77ec 0.9.0 -11 | 33.1 MB/s | 2445 MB/s | 27.38 | silesia.tar | | misa77ec 0.9.0 -12 | 5.81 MB/s | 2496 MB/s | 25.83 | silesia.tar | | misa77ec 0.9.0 -13 | 1.39 MB/s | 2633 MB/s | 24.82 | silesia.tar | | lz4 1.11.0 | 383 MB/s | 2551 MB/s | 47.32 | silesia.tar | | lz4hc 1.11.0 -9 | 21.2 MB/s | 2480 MB/s | 36.75 | silesia.tar | | lz4hc 1.11.0 -12 | 7.80 MB/s | 2563 MB/s | 36.45 | silesia.tar | | lzav 7.2 -1 | 341 MB/s | 1697 MB/s | 39.23 | silesia.tar | | lzav 7.2 -2 | 69.6 MB/s | 1719 MB/s | 34.54 | silesia.tar | | zxc 1.0.0 -3 | 122 MB/s | 3719 MB/s | 46.59 | silesia.tar | | zxc 1.0.0 -5 | 54.5 MB/s | 3250 MB/s | 40.81 | silesia.tar | | zxc 1.0.0 -7 | 5.11 MB/s | 1989 MB/s | 33.09 | silesia.tar | | zstd 1.5.7 -1 | 297 MB/s | 905 MB/s | 34.54 | silesia.tar | | zstd 1.5.7 -5 | 98.6 MB/s | 853 MB/s | 29.60 | silesia.tar | | zstd 1.5.7 -11 | 26.7 MB/s | 976 MB/s | 27.35 | silesia.tar | | zstd 1.5.7 -15 | 6.86 MB/s | 997 MB/s | 26.83 | silesia.tar | | zstd 1.5.7 -19 | 2.32 MB/s | 870 MB/s | 24.93 | silesia.tar | | zstd 1.5.7 -22 | 1.51 MB/s | 813 MB/s | 24.67 | silesia.tar | | zlib 1.4 -9 | 7.41 MB/s | 199 MB/s | 31.91 | silesia.tar | | libdeflate 1.26 -12 | 3.08 MB/s | 599 MB/s | 30.51 | silesia.tar | | brotli 1.2.0 -5 | 40.5 MB/s | 284 MB/s | 28.11 | silesia.tar | | brotli 1.2.0 -8 | 12.7 MB/s | 309 MB/s | 26.96 | silesia.tar | | xz 5.8.4 -6 | 2.30 MB/s | 78.1 MB/s | 23.35 | silesia.tar | | xz 5.8.4 -9 | 2.01 MB/s | 79.1 MB/s | 23.01 | silesia.tar | | bzip3 1.5.4 -5 | 9.38 MB/s | 9.79 MB/s | 22.29 | silesia.tar | | bzip2 1.0.8 -9 | 9.11 MB/s | 26.7 MB/s | 25.75 | silesia.tar | There's no standard corpus for this, so I unwrapped the archives of some games (14 games, using 12 different engines), and put together a corpus containing the following data types: textures (33 %), geometry (15 %), levels (14 %), engine packages (13 %), other raster data (10 %), text and tables (9 %) and animation (6 %). It's about 263 MB, and games usually compress data in small independent blocks, so I've included results at 256 KiB and 64 KiB block framings. The takeaways are quite similar to those for silesia, except that levels 12 and 13 get better ratios than zstd here. Also, the relative placement of codecs here is not that sensitive to blocked framing (although their absolute ratios do worsen as block size reduces). Table: game asset corpus, whole file (Intel) | Compressor name | Compression | Decompress. | Compr. size | Ratio | |---|---|---|---|---| | misa77 0.9.0 -1 | 330 MB/s | 4255 MB/s | 150705323 | 57.24 | | misa77 0.9.0 -2 | 225 MB/s | 4865 MB/s | 145767581 | 55.36 | | misa77 0.9.0 -3 | 85.5 MB/s | 5700 MB/s | 141725840 | 53.83 | | misa77 0.9.0 -4 | 37.0 MB/s | 4501 MB/s | 135244018 | 51.36 | | misa77 0.9.0 -5 | 10.9 MB/s | 4567 MB/s | 129910358 | 49.34 | | misa77 0.9.0 -6 | 1.94 MB/s | 5417 MB/s | 116372402 | 44.20 | | misa77ec 0.9.0 -11 | 34.0 MB/s | 2218 MB/s | 96343225 | 36.59 | | misa77ec 0.9.0 -12 | 6.92 MB/s | 2179 MB/s | 90918083 | 34.53 | | misa77ec 0.9.0 -13 | 1.68 MB/s | 2279 MB/s | 86023726 | 32.67 | | lz4 1.11.0 | 534 MB/s | 2980 MB/s | 142823813 | 54.24 | | lz4hc 1.11.0 -9 | 23.6 MB/s | 2746 MB/s | 122165338 | 46.40 | | lz4hc 1.11.0 -12 | 6.70 MB/s | 2834 MB/s | 121732829 | 46.23 | | lzav 7.2 -1 | 506 MB/s | 2248 MB/s | 132868680 | 50.46 | | lzav 7.2 -2 | 93.5 MB/s | 1931 MB/s | 121761787 | 46.24 | | zxc 1.0.0 -3 | 184 MB/s | 4125 MB/s | 154902064 | 58.83 | | zxc 1.0.0 -5 | 57.7 MB/s | 3402 MB/s | 132312231 | 50.25 | | zxc 1.0.0 -7 | 7.25 MB/s | 1724 MB/s | 117229590 | 44.52 | | zstd 1.5.7 -1 | 360 MB/s | 792 MB/s | 114616340 | 43.53 | | zstd 1.5.7 -5 | 100 MB/s | 748 MB/s | 104365048 | 39.64 | | zstd 1.5.7 -11 | 36.0 MB/s | 784 MB/s | 100651951 | 38.23 | | zstd 1.5.7 -15 | 11.4 MB/s | 791 MB/s | 100226917 | 38.07 | | zstd 1.5.7 -19 | 3.80 MB/s | 602 MB/s | 91747266 | 34.84 | | zstd 1.5.7 -22 | 2.39 MB/s | 590 MB/s | 91643641 | 34.81 | | zlib 1.4 -9 | 4.25 MB/s | 182 MB/s | 106990390 | 40.63 | | libdeflate 1.26 -12 | 4.18 MB/s | 466 MB/s | 103400315 | 39.27 | | brotli 1.2.0 -5 | 40.6 MB/s | 200 MB/s | 98941974 | 37.58 | | brotli 1.2.0 -8 | 9.93 MB/s | 200 MB/s | 97786595 | 37.14 | | xz 5.8.4 -6 | 3.07 MB/s | 52.8 MB/s | 80487772 | 30.57 | | xz 5.8.4 -9 | 2.65 MB/s | 52.8 MB/s | 80312924 | 30.50 | | bzip3 1.5.4 -5 | 8.69 MB/s | 8.92 MB/s | 96093841 | 36.50 | | bzip2 1.0.8 -9 | 6.96 MB/s | 22.4 MB/s | 101586954 | 38.58 | Table: game asset corpus, 256 KiB blocks (Intel) | Compressor name | Compression | Decompress. | Compr. size | Ratio | |---|---|---|---|---| | misa77 0.9.0 -1 | 336 MB/s | 4190 MB/s | 151897710 | 57.69 | | misa77 0.9.0 -2 | 228 MB/s | 4789 MB/s | 147100669 | 55.87 | | misa77 0.9.0 -3 | 85.2 MB/s | 5602 MB/s | 143155756 | 54.37 | | misa77 0.9.0 -4 | 38.5 MB/s | 4403 MB/s | 136732102 | 51.93 | | misa77 0.9.0 -5 | 9.97 MB/s | 4466 MB/s | 131565676 | 49.97 | | misa77 0.9.0 -6 | 2.59 MB/s | 5293 MB/s | 121713088 | 46.23 | | misa77ec 0.9.0 -11 | 24.0 MB/s | 2081 MB/s | 102573732 | 38.96 | | misa77ec 0.9.0 -12 | 3.65 MB/s | 2052 MB/s | 95994848 | 36.46 | | misa77ec 0.9.0 -13 | 1.57 MB/s | 2188 MB/s | 91218292 | 34.64 | | lz4 1.11.0 | 540 MB/s | 2982 MB/s | 143456810 | 54.48 | | lz4hc 1.11.0 -9 | 25.2 MB/s | 2738 MB/s | 123672012 | 46.97 | | lz4hc 1.11.0 -12 | 7.28 MB/s | 2828 MB/s | 123260887 | 46.81 | | lzav 7.2 -1 | 492 MB/s | 2275 MB/s | 138471611 | 52.59 | | lzav 7.2 -2 | 110 MB/s | 1938 MB/s | 129111210 | 49.04 | | zxc 1.0.0 -3 | 187 MB/s | 3302 MB/s | 153199994 | 58.18 | | zxc 1.0.0 -5 | 59.6 MB/s | 2728 MB/s | 132924513 | 50.48 | | zxc 1.0.0 -7 | 7.31 MB/s | 1463 MB/s | 117520179 | 44.63 | | zstd 1.5.7 -1 | 343 MB/s | 761 MB/s | 115076662 | 43.71 | | zstd 1.5.7 -5 | 94.3 MB/s | 745 MB/s | 108931410 | 41.37 | | zstd 1.5.7 -11 | 19.8 MB/s | 753 MB/s | 103735709 | 39.40 | | zstd 1.5.7 -15 | 7.79 MB/s | 576 MB/s | 97587093 | 37.06 | | zstd 1.5.7 -19 | 3.76 MB/s | 554 MB/s | 96663587 | 36.71 | | zstd 1.5.7 -22 | 2.99 MB/s | 553 MB/s | 96651131 | 36.71 | | zlib 1.4 -9 | 4.45 MB/s | 181 MB/s | 107525194 | 40.84 | | libdeflate 1.26 -12 | 4.13 MB/s | 459 MB/s | 104033438 | 39.51 | | brotli 1.2.0 -5 | 38.3 MB/s | 191 MB/s | 100099465 | 38.02 | | brotli 1.2.0 -8 | 23.3 MB/s | 190 MB/s | 99516558 | 37.80 | | xz 5.8.4 -6 | 3.78 MB/s | 49.5 MB/s | 85225544 | 32.37 | | xz 5.8.4 -9 | 2.43 MB/s | 48.4 MB/s | 85225544 | 32.37 | | bzip3 1.5.4 -5 | 8.64 MB/s | 9.56 MB/s | 94522128 | 35.90 | | bzip2 1.0.8 -9 | 8.38 MB/s | 23.6 MB/s | 102207006 | 38.82 | Table: game asset corpus, 64 KiB blocks (Intel) | Compressor name | Compression | Decompress. | Compr. size | Ratio | |---|---|---|---|---| | misa77 0.9.0 -1 | 343 MB/s | 4112 MB/s | 155591506 | 59.09 | | misa77 0.9.0 -2 | 229 MB/s | 4650 MB/s | 151249040 | 57.44 | | misa77 0.9.0 -3 | 83.8 MB/s | 5398 MB/s | 147471320 | 56.01 | | misa77 0.9.0 -4 | 37.5 MB/s | 4191 MB/s | 141329601 | 53.68 | | misa77 0.9.0 -5 | 12.1 MB/s | 4257 MB/s | 136723427 | 51.93 | | misa77 0.9.0 -6 | 2.77 MB/s | 5065 MB/s | 126321138 | 47.98 | | misa77ec 0.9.0 -11 | 33.3 MB/s | 1878 MB/s | 107097433 | 40.67 | | misa77ec 0.9.0 -12 | 3.78 MB/s | 1882 MB/s | 101424823 | 38.52 | | misa77ec 0.9.0 -13 | 1.85 MB/s | 2028 MB/s | 96372610 | 36.60 | | lz4 1.11.0 | 442 MB/s | 2297 MB/s | 143943797 | 54.67 | | lz4hc 1.11.0 -9 | 31.5 MB/s | 2721 MB/s | 128308752 | 48.73 | | lz4hc 1.11.0 -12 | 9.
Comments
No comments yet. Start the discussion.