B1.6 · Branding Beats Its Own Integer — manuscript appendix 1.1
Branding beats its own integer.
Chapter 1.3 measured a sentence worth promoting to its own appendix: the same snowflake rendered as decimal text (19 digits) costs 73 bytes per key on Valkey’s new table, eight more than its 14-byte branded base62 form at 65. At the storage layer the brand is a discount, not a tax. This module asks the follow-up the finding deserves: does the CPU agree? The encode path — u64 in, text out — is measured in all five runtimes of the canon, against the real implementations, with the decimal rendering as the opponent in each.
The module teaches content/bcs1.a1.md. The answer has texture: the compiled runtimes agree emphatically, the BEAM records a tie, and V8 records the one loss — in exactly the place the contract already prescribes a native crossing.
7.21 against 20.49, Rust 5.14
against 21.77, Go 40.02 in a split across API regimes, Elixir
132.5 against 133.6 — a tie, Node 381 against
45.6 — the one loss, all ns/op from the committed outputs.The question the storage record earned
content/bcs1.a1.md · scope and methodThe storage verdict is already committed: 65 bytes per key for the 14-byte branded form against 73 for its own 19-digit decimal rendering, on Valkey 8.1’s single-allocation entries — five fewer bytes pushed the embedded object down one allocator size class. A discount at rest says nothing about the clock. The appendix puts the encode path itself on the bench, runtime by runtime, and inherits the storage rows verbatim rather than re-measuring them.
Method, as recorded in the committed outputs: each runtime encodes snowflakes with
the low 20 bits varied (to defeat constant folding), accumulates a byte of each output into a sink
(to defeat dead-code elimination), and reports the best of three runs — five on Node. Toolchains as
recorded under bench/branding-vs-decimal/: cc 13.3.0 at -O2, rustc 1.75.0,
go 1.22.2, Elixir with the native codec loaded, and Node v22.22.2 running the TypeScript
implementation directly.
Measured — the committed record
bench/branding-vs-decimalruntime branded encode decimal encode committed output C (cc 13.3, -O2) 7.21 ns/op 20.49 ns/op (itoa) c_bench.out Rust 1.75 (-O) 5.14 ns/op 21.77 itoa · 31.61 to_string rust_bench.out Go 1.22.2 40.02 ns/op 48.29 FormatUint · 25.87 AppendUint go_bench.out Elixir (native) 132.5 ns/op 133.6 ns/op elixir_bench.out Node 22 (pure TS) 381 ns/op 45.6 ns/op (BigInt toString) node_bench.out
One host, the recorded toolchains; ratios travel better than absolute numbers. The three dives below take the record apart: the structure that predicts it, the five clocks that confirm and complicate it, and the accounting that settles it.
The dives
three lessons, fixed by the chapter specThe Two Renderings
Exactly 11 divmods by 62 into fixed positions 3 through 13, plus a 3-byte namespace copy — against about 19 divmods by 10 into a width known only at the end. The structure, derived before any clock runs.
B1.6.2The Five Runtimes
The measured table in full — C and Rust cash the derivation, Go records a split across API regimes, the BEAM records a tie, and Node records the one loss in exactly the prescribed place.
B1.6.3The Whole-System Accounting
Minted once, cheaper forever — 8 bytes per key at rest, 5 bytes on every wire hop, and the Node worst case amortized to a third of one percent of a core.
The storage rows are Chapter 1.3’s, taught in module B1.3 · The ID System and inherited here verbatim. The sentence under test: the contract’s wire form is cheaper than the “lean” alternative it is usually defended against.
References
sources · relatedSources
- Söderqvist — A new hash tablethe single-allocation entry layout behind the size-class step the storage rows ride
- Wikipedia — Snowflake IDthe integer the brand is measured against
Related
- B1 — Ideas Behindthe chapter landing; the Part I arc
- B1.3 — The ID Systemthe storage record this appendix follows up — 65 against 73
- BCS — the course homethe law, the id anatomy, the chapter map
- Functional Programming in Elixirthe umbrella where echo_data and its native codec live — the Elixir tie
- EchoMQ — the coursethe bus where branded keys ride the wire