IC compression measurement
The canister uses the ordinary prepared wasm64 SDK runtime, bounded Wire and the SDK allocator. Its typed-root fixture service is transient: restoration creates an empty slot. This benchmark makes no persistent staging or application upgrade claim. Algorithms remain independent of the benchmark.
Use the pinned environment and an exclusively owned Cargo target. Resolve the workspace lockfile before locked offline commands; experiment coordinators own shared target leases and dependency resolution:
export CARGO_TARGET_DIR=/absolute/exclusively-owned-target
export TMPDIR=/absolute/temporary-directory
source tools/env.sh
cargo test --manifest-path benches/compression/Cargo.toml --workspace --locked --offline
cargo build --manifest-path benches/compression/Cargo.toml -p cdk-rsx-compression-oracle --locked --offline
node --test benches/compression/*.test.mjs
python3 cdk-rsx/tools/build-app.py \
--manifest-path benches/compression/Cargo.toml --package cdk-rsx-compression-bench \
--name compression-bench --out-dir /absolute/fresh-artifact \
--debug-artifacts --archive-sources --offline --locked
Use the existing locked tests/pocketic host package. Generate its generic
runtime with cdk-rsx/tools/wire_runtime.py and an already built SDK Wasm
tool as described in the host guide. The runner
reuses its Wire actor and the existing owned session, canonical artifact
verifier, complete trace ledger and bounded profile helpers. It creates one
server and instance and shuts down only its own server. Raw Cargo Wasm is not
accepted; preserve canonical artifacts at their recorded absolute paths.
For deeply nested worktrees, give PocketIC a short temporary root before running:
export CDK_RSX_BENCH_TMPDIR=/dev/shm/lz4-pic-20261030
The owned session creates and removes only its own subdirectory beneath this root. Linux Unix socket path limits can reject a long checkout-derived default.
node benches/compression/run.mjs \
--artifact /absolute/fresh-artifact \
--oracle "$CARGO_TARGET_DIR/$CARGO_BUILD_TARGET/debug/cdk-rsx-compression-oracle" \
--out /absolute/fresh-results --pocket-ic /absolute/qualified-pocket-ic
The compact screen compares LZ4 with gzip levels 1 (fast) and 6 (default), measuring compression/decompression of repeated and
reproducible random 128/2048/65536-byte inputs at exactly 32 logical operations
per update, plus production-packed mixed Reactor batches with 1/8/32/128/500
frames. Its producer uses tripwire::encode_envelope(SharedBatch::from(Batch));
registry lz4_flex 0.14.0 independently extracts the exact inner packed bytes.
Public synthetic bodies do not claim to be captured application traffic. Exact
raw bytes, upstream blocks and metadata are archived. --corpus MANIFEST reuses
the same producer corpus for matched candidates.
--suite full selects sizes 32/128/512/2048/16384/65536/262144/1900000 and
batches 1/8/32/128/500, both patterns and directions. Dimensions exceeding the
64 MiB logical-input or initialized-output bound remain explicit rejected rows.
Other filters are --sizes, --batches, --codecs lz4,gzip-1,gzip-6, --patterns repeat,random,
--directions compress,decompress, --buffers cohort,single and --samples.
--dry-run prints synthetic dimensions without an artifact or server; the five
actual producer sizes are added when its corpus is loaded. --help lists options.
For generic corpora, --corpus MANIFEST accepts a JSON array of
{"name":"module-wasm","raw":"module.wasm"} records, with paths relative to the
manifest; encoded may supply an independent LZ4 block. Names must be unique
file-safe strings. Each raw input is bounded at 2,000,000 bytes. Use
--sizes none --batches 1,32 --codecs lz4,gzip-1,gzip-6 to measure only those
exact files, including text, JSON and real Wasm. The host generates and archives
independent gzip references with Node zlib at the selected levels. Default
compression-before-decompression ordering reuses the first verified actual
Wasm output for the corresponding input and codec; decompression-only runs use
the independent reference. Every decompression row records its input origin.
Each scenario has separate traced updates for raw setup, upstream block staging (decompression), loop control, one full warmup and every measured sample. Raw and encoded bytes arrive in separate updates so near-2 MiB incompressible inputs stay within ingress limits. Setup refuses an occupied fixture; reference staging cannot replace saved bytes. A prior update preserves allocated buffers but does not warm the next physical execution's page tracking.
The default cohort retains one initialized output slot per logical operation and
reuses those slots across warmup and measurement. Every output is checked after
the ending counter, including canaries around its exact destination span.
Compression reuses a decoding scratch buffer for its local check; the host also
decodes actual Wasm output with registry upstream LZ4 or Node zlib gunzipSync.
Reported compressed sizes are actual Wasm output lengths. Every decoded byte is
compared to the original. The labelled single diagnostic reuses one slot
within the loop and checks only its final output. Both layouts black-box full
inputs/outputs and returned lengths. The body executes exactly batch codec
calls, never batch * batch.
All compressors use the same initialized destination bound of
floor(rawBytes * 110 / 100) + 64; decoders receive an exact raw-sized output
span. Gzip is benchmark-only flate2 1.1.10 with its pure Rust backend. Each
gzip operation constructs its own encoder/decoder inside the body and includes
internal allocations, stream completion and destruction. Gzip decoding requires
one complete member, consumes the exact input, validates CRC/ISIZE and fills the
exact output span. The reusable LZ4 algorithm is unchanged.
Counter 0 covers the loop, codec, result writes, ending probe and faults between probes. Borrowing, report-vector allocation/zeroing, checks, reply and cleanup sit outside that interval and stay in their actual complete physical-call traces. Output allocation/initialization is charged in setup. Footprints report slot and scratch bytes, heap capacity and runtime/Store/control pages outside captures; these are not live payload size or host RSS. Observer sample queries run after measured updates and are labelled separately. Complete instructions/page fees, cycles, latency and body counters are independent. Non-page charges include API, copies and computation; no baseline or page subtraction is applied.
The default actual-Wasm correctness gate batches independent upstream and crafted
standard blocks: short lengths, table thresholds 65534/65535/65536, offsets 1–31,
literal/match boundaries around 16/32/48, all 256 source/destination alignment
pairs, malformed offsets/truncation, short destinations and canaries. The host
checks every decoded byte and independently decodes every actual Wasm-produced
block. --suite correctness runs that gate alone; --correctness 0 skips it for
a diagnostic measurement and does not qualify SIMD correctness. Near-2 MiB
blocks use staged bulk calls: select --sizes 1900000 --batches 1,8 in both
directions. Canaries detect out-of-span writes; absence of overreads also needs
source review and exact bounded-access arguments.
The separate --features match-probe correctness image compiles the selected
vendor simd_match.rs helper directly without extending the production API. Its
endpoint checks every first mismatch 0–65 across 16×16 alignments. The bench
crate supplies the necessary simd_wasm64 gate. Keep performance artifacts
featureless and matched. Native fallback execution does not establish that an
installed Wasm SIMD path ran. The selected decoder and copy helpers are upstream
implementations; the full public block/oracle boundary corpus remains enabled.
--profiles N adds at most N bounded matched unprofiled/profiled pairs with
sizes <=2048 and batches <=128; default 0. --symbolize auto|none|PATH uses
canonical debug sidecars. Outputs retain source/artifact/host/server receipts,
installation transport hash, plan, raw traces, cycle snapshots, setup/warmup/
control records, all results, interoperability corpora and actual output bytes.
Failures stay explicit; incomplete traces stop the run. Complete application
selection uses the matched Heavy16 gate.
The dated LZ4 round report
records the selected source, artifact identities, measurements and separate
actual-Wasm recovery qualification.