Atelier des rouesLab FR
Register/AT.EX26.02
Controlled experiment · AT.EX26.02

The byte cost of a prefix

1/4 Educational or exploratory value AI-assisted literature assessment · one reading

I compare the byte costs of Elias gamma and unsigned LEB128 for the specified weight-four, 64-word-block layout, and report an exhaustive finite sweep. Cover’s enumerative source encoding explains ranking fixed-composition objects; Elias and the WebAssembly specification supply the length-code baselines. My result is a local crossover calculation, potentially useful when choosing a header. Its 65,536-length range and lack of an encoded-stream check limit the claim; testing another weight and real bytes is the next test.

Thomas M. Cover, “Enumerative Source Encoding” · Peter Elias, “Universal Codeword Sets and Representations of the Integers” · WebAssembly Core Specification, “Values”

How I rate results

Assumptions

For weight-four blocks of 64 I set b=⌈n/64⌉ and ℓ=bit_length(n). The last byte has p=(−1−5b) mod 8 unused bits. I compare ⌈(2ℓ−1−p)/8⌉ with ⌈ℓ/7⌉.

Result

I reproduce the exact excess on 65,536 lengths and all 353 sign intervals in the benchmark.

Prior work

Cover · WebAssembly · LEB128 · Elias

Next question

I will test the calculation at another weight against an actual encoded stream.

Read the argument and prior work · View supporting evidence

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.