Generated typed Codec.auto codecs vs the reflective walker (2026-11-10)

What: the v0.29.9 generated codecs (rust/crates/lower/src/lower/auto_codec.rs, runtime-go/rt/codec_auto_gen.go) against the reflective walker they replace, on the large-model research fixture (a list of records, a Dict of records, one large String) compiled as a Sky program (app/). "Reference" is the same binary with rt.AutoCodecUseReference(true): the walker plus the v0.29.6 single-pass JSON writer, which is the v0.29.8 behaviour. "Encode" is Spa_modelToJson (Codec.toJson (Codec.auto blank) m), "decode" is Spa_modelFromJson (parse plus build). Both modes are checked to give the same text before timing.

How: ./run.sh results (then ./summarise.sh results), one process per target, mode, shape and size, -benchtime 2s -count 3, median shown. Native: Go 1.26.1 darwin/arm64, Apple M1. Wasm: the same test binary built for js/wasm, run with Node (wasm_exec_node.js). The machine was under memory pressure from other work (swap about 93% used), so treat single numbers as indicative; the ratios held in every repeat.

targetopshapeMBreference msgenerated msspeed-upreference allocsgenerated allocs
nativeencodelist16.791.086.3x6730633
nativeencodelist320.323.276.2x20285938
nativeencodedict18.192.233.7x6733838
nativeencodedict325.167.163.5x20290143
nativeencodeblob10.950.951.0x187
nativeencodeblob32.742.821.0x187
nativedecodelist120.959.472.2x250190145825
nativedecodelist362.7527.932.2x751469437389
nativedecodedict130.1811.082.7x262637153183
nativedecodedict369.7634.532.0x788174458765
nativedecodeblob14.814.801.0x7152
nativedecodeblob314.0414.191.0x7354
wasmencodelist146.979.065.2x9416533
wasmencodelist3138.1722.046.3x28342638
wasmencodedict152.3612.604.2x9419738
wasmencodedict3159.4737.174.3x28346843
wasmencodeblob12.372.331.0x237
wasmencodeblob36.976.891.0x237
wasmdecodelist1113.2457.042.0x334647145865
wasmdecodelist3368.92165.912.2x1004721437429
wasmdecodedict1127.2262.032.1x347112153197
wasmdecodedict3404.90202.422.0x1041445458711
wasmdecodeblob121.3421.321.0x12993
wasmdecodeblob366.2365.151.0x13296

Targets from the plan: 1 MB Wasm list encode under 10 ms (9.06 ms; the research measured 34.7 ms for the reference path on a quieter machine, 46.97 ms here), boot decode at least 1.8 times faster (2.0 to 2.7 times, native and Wasm). A blob is one String: the walker already writes it in one pass, so it does not change. Decode still parses the whole document into a tree first (jsonParseDocument, unchanged), which is now most of the decode time and most of its allocations.

Wasm size (gzip -9 of the client .wasm)

clientv0.29.8v0.29.9change
examples/60-spa-todos client (sky build --wasm, no generated codec)2,889,0252,893,622+4,597 (+0.16%)
examples/61-app-kanban (--target web:app, one generated codec for its Model)2,896,2702,916,380+20,110 (+0.69%)

examples/19-skyforum is a Sky.Live app, so it has no Wasm client. --target web:app does not build it with either release (the split's first-paint codec names an undefined seedComments).

Two size findings were fixed while measuring: reflect.Type.MethodByName in the registration check made the linker keep every exported method (about 28 KB gzip on kanban; now Implements), and errors.As plus fmt.Sprintf in the quota warning cost about 10 KB gzip (now a type assertion and strconv).