Skip to content

Compatibility and performance

pulzr-codec replaced a runtime built on quickjs-emscripten. It was held to answer the same, byte for byte, across public corpora:

Suite Codecs Cases Same
The Things Network device repository: every codec with examples 679 3,365 3,358
ChirpStack device profiles: every codec with test files 79 445 445
zigbee-herdsman-converters 26.136.0: golden devices’ frames, configure and commands, and the definition lookup for every model id 6 4,896 4,896

Every difference, and why the new answer stands:

Case Before Now Why
An array growing for ever stopped at 50 ms decoder exceeded 16 MB Stopped at the limit it hit
A backtracking regex stopped when the worker was killed decoder exceeded 50 ms Stopped in the engine at the deadline
A syntax error, a ReferenceError, a BigInt in JSON.stringify Bellard QuickJS’s wording QuickJS-ng’s The same error, a newer engine’s words
Math.log(3) 1.0986122886681096 1.0986122886681098 Correctly rounded, as V8 gives it
toFixed on a tie 0.007812 0.007813 The specification’s rounding; TTN’s expected outputs agree
A codec calling console.log ReferenceError decodes QuickJS-ng has console, writing nowhere

A request’s input reaches the codec as the text that was sent: a 17-digit float is not re-encoded on the way in.

Linux on aarch64, one call at a time per process. Small: a 13.8 KB TTN codec. Large: a 2.4 MB zigbee-herdsman-converters bundle.

quickjs-emscripten pulzr-codec
Small, cold (first call of a codec never seen) 17.6 ms 3.8 ms
Small, evicted (compiled, not warm) 8.2 ms 0.13 ms
Small, warm p50 / p99 0.035 / 0.062 ms 0.019 / 0.030 ms
Large, cold 322 ms 280 ms
Large, evicted 287 ms 60 ms
Throughput, one core, small codec 31,400 calls/s 50,400 calls/s
Resident, idle 70 MB 91 MB
Resident, 256 codecs warm 1,123 MB 290 MB
Resident, 2,048 codecs warm 2,545 to 7,448 MB about 1,700 MB
Ready after start 0.4 s
Artifact Size
The engine, its Wizer snapshot 1.92 MB
A small codec’s compiled artifact 21 KB on average
The pulzr-codec binary (Linux) 19 MB
The container image 76 MB

Crypto as host calls: opening a Tuya Smart Life account’s device list (AES-GCM, HMAC-SHA256, MD5, base64) on an M2 Pro, against the 50 ms call budget:

Device list Plain JavaScript pulzr.*
43 KB (30 devices) 44.5 ms 4.2 ms
170 KB (120) over 50 ms 8.2 ms
1.4 MB (1,000) over 50 ms 46.8 ms

On macOS resident memory is higher: wasmtime’s copy-on-write memory images need Linux’s memfd.