Browser Wire scalar-byte traversal — 24 October 2026
The initial runtime was CDK commit 20083a2041080a4b2b52296e107a904e9fd3eb5d.
The Showtime browser uses generated JavaScript ICWire, not Candid. Its opaque
encrypted records are represented by generated scalar u8 lists and fixed
arrays. The previous runtime recursively dispatched every byte through the
general integer implementation, constructing BigInts and integer ranges.
The selected implementation handles only concrete, unconstrained u8
list/array children in bulk. It retains every visited value node and child-depth
charge, scalar number/range checks, sparse-array rejection and owned decoded
ordinary arrays. Aliases and scalar validators use the original general path.
Measured in real headless Chromium on the development workstation, seven warm
timing groups per operation, with the same frozen NativeWire adapter and exact
1/100/500-record inputs. The matched receipts below are unsampled; a separate
CPU profile identified generic traversal and schema resolution as hotspots.
There is no real IC HTTP or WebRTC in this CPU boundary benchmark: a fixed
canonical error reply isolates conversion/encoding/decoding. No end-to-end
throughput, network latency or IC instruction qualification follows.
| 500 opaque packets, 160,536-byte query | Before p50 ms | Byte traversal p50 ms |
|---|---|---|
| Generated query encode | 18.30 | 1.99 |
| Generated query decode | 10.17 | 2.99 |
| NativeWire query conversion, encoding and reply decode | 33.10 | 17.35 |
| Envelope decode, BLAKE3 commitments and NativeWire query | 63.30 | 39.80 |
One- and 100-record cohorts also improved. Owner snapshot decoding remains dominated by general schema work: 512 orders and 512 nonce winners improved from 16.30 to 15.00 ms. Its remaining cost is retained for subsequent profiling.
Alias-resolution pass
The second pass removes Object.keys(types) from each alias traversal. Common
one-hop references perform only the actual lookup; longer chains use a local
set to reject repeated names. It retains own-property checks, all alias and
concrete validators in order, recursion through concrete nodes, independent
registries and registry changes between calls. Trusted metadata and validators
must not mutate a registry during the same alias resolution.
The second-pass receipt uses the same frozen adapter, schema, browser and inputs as the first pass. Owner512 decode improves from 15.00 to 3.07 ms, query500 reply from 4.06 to 1.02 ms, and submit500 reply from 5.40 to 0.842 ms. The complete 500-packet CPU boundary improves from 39.80 to 37.10 ms. Four additional tests cover aliases, validators, cycles, recursive records and per-registry behavior (13 SDK tests total); five current generated DTO parity cases also pass.
The combined application receipt additionally uses
Showtime's separately optimized NativeWire adapter; its different adapter hash
is explicit. Complete query preparation/encoding/reply decode improves from
33.10 to 5.47 ms, and the combined hashing/decoding/query CPU boundary improves
from 63.30 to 26.45 ms. These numbers include both application and CDK changes;
they must not be attributed to alias resolution alone.
The reproducible harness and frozen adapter are in the authorized neighboring
Showtime workspace at experiments/icwire-browser/bench.mjs; the receipts pin
the generated schema, runtime, frozen adapter and browser bundle. Run from that
workspace:
ICWIRE_BENCH_RUNTIME=experiments/icwire-browser/baseline/runtime.mjs \
node experiments/icwire-browser/bench.mjs /tmp/wire-before.json
node experiments/icwire-browser/bench.mjs /tmp/wire-after.json
node --test experiments/icwire-browser/parity.test.mjs
The baseline and byte traversal receipts preserve matched input digests. Five current generated DTO fixtures preserve exact bytes, values and malformed input classification. The SDK's focused byte tests cover all scalar values, budgets, depth, truncation, canonical lengths, sparse inputs and validators; the existing wire-client tests also pass (nine SDK tests total).
The old browser Rust candidate was never built into a usable current-protocol Wasm module. These measurements establish a JavaScript improvement, not a JavaScript-versus-Wasm winner. Earlier backend Wasm32 and crypto-canister measurements concern a different execution boundary.