Generic LZ4 and gzip on IC Wasm64, 30 October 2026
Actual Wasm64 measurements of the selected SIMD LZ4 encoder and checked upstream decoder, versus flate2 1.1.10 with its pure Rust miniz_oxide 0.9.1 backend at gzip levels 1 and 6. Both codecs run in one freshly built 396,111-byte benchmark canister. LZ4 library, SDK and RRT algorithms are unchanged.
The corpus has 18 inputs: four byte sizes each of public Markdown/documentation, valid synthetic forum JSON, deterministic pseudorandom bytes and intentionally repetitive logs, plus two complete actual Wasm modules. The modules retain their name sections; they are not stripped code-only samples. Compression sizes below are actual canister outputs: raw LZ4 blocks versus complete gzip streams including framing and CRC.
Each cost is the mean of two measured updates after a separate warmup. Allocation and initialization of source/destination cohorts occurs in separate setup updates. Fresh gzip stream construction, internal allocation, finish, CRC and teardown are inside its measured codec interval. LZ4 uses borrowed input and caller-owned output. Every logical output is checked. Paired decompression reads exactly the independently verified bytes produced by that encoder.
There are 216 measured rows and 432 measured physical updates (7,128 codec operations), across batches 1 and 32. A batch repeats one payload into separate retained output buffers; it is not 32 independently arriving requests. Page tracking resets each message, including after warmup. All instructions include their applicable page fees. Counter0 body costs include loop/probe/output work; whole validated updates additionally include SDK/Wire, reporting and post-clock validation. Compression validation also decompresses every output; complete endpoint totals therefore describe this checked fixture.
Compressed sizes
| Input | Raw bytes | LZ4 bytes (% of raw) | gzip1 bytes (% of raw) | gzip6 bytes (% of raw) |
|---|---|---|---|---|
| docs-128 | 128 | 113 (88.3%) | 125 (97.7%) | 125 (97.7%) |
| forum-json-128 | 128 | 122 (95.3%) | 121 (94.5%) | 118 (92.2%) |
| random-128 | 128 | 130 (101.6%) | 151 (118.0%) | 151 (118.0%) |
| repetitive-log-128 | 128 | 127 (99.2%) | 132 (103.1%) | 132 (103.1%) |
| docs-2048 | 2,048 | 1,506 (73.5%) | 1,116 (54.5%) | 1,063 (51.9%) |
| forum-json-2048 | 2,048 | 1,344 (65.6%) | 1,007 (49.2%) | 928 (45.3%) |
| random-2048 | 2,048 | 2,057 (100.4%) | 2,071 (101.1%) | 2,071 (101.1%) |
| repetitive-log-2048 | 2,048 | 210 (10.3%) | 195 (9.5%) | 182 (8.9%) |
| docs-65536 | 65,536 | 36,483 (55.7%) | 31,732 (48.4%) | 22,846 (34.9%) |
| forum-json-65536 | 65,536 | 8,656 (13.2%) | 7,584 (11.6%) | 5,288 (8.1%) |
| random-65536 | 65,536 | 65,794 (100.4%) | 65,613 (100.1%) | 65,569 (100.1%) |
| repetitive-log-65536 | 65,536 | 459 (0.7%) | 1,052 (1.6%) | 507 (0.8%) |
| docs-1048576 | 1,048,576 | 567,078 (54.1%) | 522,999 (49.9%) | 355,848 (33.9%) |
| forum-json-1048576 | 1,048,576 | 119,497 (11.4%) | 100,748 (9.6%) | 61,759 (5.9%) |
| random-1048576 | 1,048,576 | 1,052,690 (100.4%) | 1,049,571 (100.1%) | 1,048,764 (100.0%) |
| repetitive-log-1048576 | 1,048,576 | 4,314 (0.4%) | 9,098 (0.9%) | 5,271 (0.5%) |
| wasm-compression-bench | 302,782 | 123,830 (40.9%) | 107,918 (35.6%) | 83,617 (27.6%) |
| wasm-callback-probe | 1,652,427 | 535,773 (32.4%) | 463,974 (28.1%) | 352,999 (21.4%) |
Codec instructions per payload, batch 1
Each cell is compression / decompression, millions of IC instructions. Setup and post-clock checking are excluded from this interval; page fees incurred within it remain included.
| Input | LZ4 | gzip1 | gzip6 |
|---|---|---|---|
| docs-128 | 0.019 / 0.002 | 2.103 / 0.792 | 2.135 / 0.792 |
| forum-json-128 | 0.019 / 0.002 | 2.100 / 0.791 | 2.131 / 0.791 |
| random-128 | 0.016 / 0.001 | 2.147 / 0.689 | 2.181 / 0.689 |
| repetitive-log-128 | 0.016 / 0.001 | 2.105 / 0.791 | 2.138 / 0.791 |
| docs-2048 | 0.161 / 0.027 | 2.499 / 0.976 | 2.965 / 0.976 |
| forum-json-2048 | 0.144 / 0.026 | 2.461 / 0.968 | 2.896 / 0.960 |
| random-2048 | 0.044 / 0.003 | 2.747 / 0.724 | 3.312 / 0.724 |
| repetitive-log-2048 | 0.028 / 0.006 | 2.169 / 0.862 | 2.373 / 0.859 |
| docs-65536 | 4.579 / 1.369 | 13.652 / 7.573 | 37.170 / 6.716 |
| forum-json-65536 | 1.305 / 0.672 | 6.051 / 4.201 | 15.256 / 3.841 |
| random-65536 | 0.695 / 0.552 | 20.881 / 6.438 | 41.137 / 2.397 |
| repetitive-log-65536 | 0.387 / 0.412 | 3.959 / 3.276 | 9.202 / 3.155 |
| docs-1048576 | 70.629 / 19.440 | 195.347 / 110.207 | 653.914 / 93.591 |
| forum-json-1048576 | 16.035 / 8.404 | 55.935 / 52.528 | 207.470 / 47.430 |
| random-1048576 | 5.763 / 5.228 | 300.288 / 97.733 | 661.814 / 24.969 |
| repetitive-log-1048576 | 3.280 / 4.133 | 27.277 / 38.715 | 112.478 / 36.941 |
| wasm-compression-bench | 14.794 / 4.259 | 44.519 / 25.622 | 176.093 / 22.682 |
| wasm-callback-probe | 64.757 / 21.708 | 193.561 / 121.956 | 870.720 / 106.758 |
Codec instructions per payload, batch 32
Each cell is compression / decompression, millions of IC instructions. Setup and post-clock checking are excluded from this interval; page fees incurred within it remain included.
| Input | LZ4 | gzip1 | gzip6 |
|---|---|---|---|
| docs-128 | 0.019 / 0.002 | 0.630 / 0.251 | 0.662 / 0.251 |
| forum-json-128 | 0.019 / 0.002 | 0.627 / 0.250 | 0.658 / 0.250 |
| random-128 | 0.016 / 0.001 | 0.675 / 0.148 | 0.708 / 0.148 |
| repetitive-log-128 | 0.016 / 0.001 | 0.632 / 0.249 | 0.665 / 0.249 |
| docs-2048 | 0.165 / 0.032 | 1.032 / 0.440 | 1.498 / 0.439 |
| forum-json-2048 | 0.149 / 0.030 | 0.994 / 0.431 | 1.429 / 0.423 |
| random-2048 | 0.049 / 0.008 | 1.279 / 0.187 | 1.844 / 0.187 |
| repetitive-log-2048 | 0.033 / 0.011 | 0.701 / 0.326 | 0.906 / 0.323 |
| docs-65536 | 4.501 / 1.291 | 12.102 / 6.953 | 35.620 / 6.097 |
| forum-json-65536 | 1.227 / 0.672 | 4.501 / 3.659 | 13.706 / 3.300 |
| random-65536 | 0.617 / 0.397 | 19.331 / 5.741 | 39.587 / 1.700 |
| repetitive-log-65536 | 0.309 / 0.412 | 2.409 / 2.735 | 7.652 / 2.614 |
| docs-1048576 | 69.389 / 18.742 | 192.634 / 109.046 | 651.201 / 92.585 |
| forum-json-1048576 | 14.794 / 8.249 | 53.222 / 51.831 | 204.758 / 46.811 |
| random-1048576 | 4.523 / 3.910 | 297.575 / 95.874 | 659.101 / 23.109 |
| repetitive-log-1048576 | 2.040 / 4.133 | 24.564 / 38.173 | 109.765 / 36.399 |
| wasm-compression-bench | 14.406 / 4.103 | 42.659 / 24.926 | 174.233 / 21.985 |
| wasm-callback-probe | 62.741 / 21.010 | 190.073 / 120.794 | 867.232 / 105.751 |
Whole checked-call example: 64 KiB documentation, batch 1
Page fees are already included in the whole instruction total. These are complete validated benchmark calls, not the codec interval.
| Codec | Compress whole I | Decompress whole I | Compress page I | Decompress page I |
|---|---|---|---|---|
| lz4 | 8,977,204 | 3,616,614 | 800,000 | 800,000 |
| gzip-1 | 23,560,711 | 9,820,359 | 2,320,000 | 1,360,000 |
| gzip-6 | 45,973,754 | 8,963,897 | 2,320,000 | 1,360,000 |
LZ4 favors instruction cost and quick decompression; gzip can produce smaller outputs on varied text, JSON and Wasm. The repetitive stress corpus is a counterexample to any universal size ranking. Pseudorandom input expands with all three encoders. These results do not establish wall-clock/mainnet throughput or another gzip implementation’s performance.
Machine-readable rows retain both body and whole costs, whole-call page fees, per-byte normalization, exact sizes and sample values. Raw traces, exact corpus inputs, build manifests and independently decoded outputs remain under the recorded local result paths.
Evidence and reproduction retain the canonical build, exact corpus and independent audits. Within each scenario, both samples have identical counters. Large batch calls include deterministic time slicing (up to 17 slices); full charges remain included. Seven native tests, four host tests, 8,128 actual-Wasm LZ4 cases and 30 gzip cases passed.