News for hackers. Stuff that matters.
Re:Understanding every byte in a WASM module by teraflop on Saturday December 23, 2023 @11:05AM (#38745211)
If you use all 8 bits of a byte for data, you need a separate way to store the length, or you need to make everything fixed-width which wastes space.

"Varints" or variable-length integers, with 7 bits of data and 1 continuation bit per byte, are used in a fairly wide variety of formats (e.g. Protobuf, SQLite and Lucene). They're compact when most of your integers are small, while still being quite simple and fast to encode/decode.

Faster alternatives tend to be more complicated, and more compact alternatives tend to be slower.

See https://en.wikipedia.org/wiki/Variable-length_quantity

Re:Understanding every byte in a WASM module by joquarky on Saturday December 23, 2023 @03:47PM (#38748063)
I wonder if something resembling this could have been better than how IPv6 attempts to solve the address space problem.
Re:Understanding every byte in a WASM module by p1mrx on Sunday December 24, 2023 @06:42PM (#38758134)
Variable-length IP addresses were considered at the time: https://datatracker.ietf.org/doc/html/rfc1752#section-10.2