64-Bit Bank Balances ‘Ought to be Enough for Anybody’?
TigerBeetle moved all amounts and balances from 64-bit to 128-bit unsigned integers because sub-cent precision (micro-cents, fuel prices, stock ticks, micropayments, digital currencies), long-lived accumulating balances and even hyperinflation can exceed 64-bit range. Ledgers use integer multiples of a user-defined minimal unit, never floats, and keep separate strictly positive debit and credit totals instead of signed balances. Generated x86-64 code shows 128-bit add, subtract, multiply and compare compile to a few carry/borrow instructions, so the overhead is immaterial. Only division needs a software routine. Since most client languages lack native 128-bit types, clients expose values as pairs of stack-allocated 64-bit integers, with helpers to convert to BigInteger, byte arrays or UUIDs.
Related posts
- A Database Without Dynamic Memory Allocation
TigerBeetle mediumAdeptTigerBeetle allocates all memory once at startup and never again, using fixed limits for connections, in-flight messages per client, replicas, message size and queries per message so that total memory is a simple compile-time sum. Beyond avoiding GC and use-after-free, static allocation bounds overload, makes resource use predictable for operators, and lets assertions on pool availability surface sizing mistakes under fuzzing rather than as production resource exhaustion. Supporting choices include fixed-size, cache-line-aligned 128-byte account and transfer structs sent zero-copy over the wire, batched queries (up to 8191 per message), and an LSM forest whose in-memory portion is preallocated and kept bounded by small incremental flushes to disk.
- How Go 1.24’s Swiss Tables saved us hundreds of gigabytes
Datadog Engineering mediumAdeptGo 1.24's new map implementation, based on Swiss Tables and extendible hashing, cut roughly 500 MiB of live heap (about 1 GiB of RSS with GOGC=100) from a 3.5-million-entry routing cache map, enough to more than offset a separate Go 1.24 mallocgc memory regression. Go 1.23 maps use 8-slot buckets with overflow chains, a 13/16 maximum load factor, and incremental growth that keeps old bucket arrays alive. Swiss Tables use 8-slot groups with a control word for SIMD-assisted probing, which removes overflow buckets and allows a 7/8 load factor. Extendible hashing caps each table at 1024 slots, so growth is bounded and splits happen per table. The post works through per-entry and per-bucket memory estimates and then applies struct-level optimizations to the map's values for further fleet-wide savings.
- Parsing JSON from Postgres in JS? Don’t get the wrong number
Neon mediumAdept
JavaScript's JSON.parse() silently corrupts Postgres bigint and numeric values beyond Number.MAX_SAFE_INTEGER, so a row id can quietly become a different id. The fix is a custom JSON parser registered with node-postgres or Neon's serverless driver; the reviver argument can't help because numbers are already float64 by then. json-custom-numbers is introduced as a drop-in replacement that matches JSON.parse() on the JSON Parsing Test Suite, supports custom number parsing, and runs only 1.5–3× slower than native, versus 4–11× for lossless-json and json-bigint. Lessons from optimizing it: sticky RegExps for primitives, manual inlining, charCodeAt over charAt, a non-recursive state machine to avoid stack overflows, and how JIT warm-up and deoptimization from invalid inputs skew benchmarks.
- Rediscovering Transaction Processing From History and First Principles
TigerBeetle easyNoviceGeneral-purpose OLTP databases hit a hard throughput ceiling on debit/credit workloads because row locks are held across multiple network round-trips, and hot rows such as a few internal accounts serialize nearly every transaction. Jim Gray's 1985 DebitCredit benchmark anticipated this, defining transaction processing in terms of double-entry bookkeeping. TigerBeetle makes debit/credit a first-class primitive: 128-byte transfers are batched up to 8000 per 1 MiB request, amortizing round-trips and eliminating row locks. It also emphasizes safety through Protocol-Aware Recovery, static memory allocation, 6000+ assertions and deterministic simulation testing. The post doubles as the announcement of a $24M Series A.
- Introducing Fast, Native Encryption in Turso Database
Turso mediumAdeptTurso Database, a Rust rewrite of SQLite, now supports native encryption at rest using AEAD ciphers (AEGIS-256 and AES-GCM). Each page is encrypted individually with a fresh nonce, and the nonce and auth tag are stored in SQLite's per-page reserved space. Database and WAL files are encrypted, while the 100-byte header is not. Keys are supplied per connection via URI and kept only in memory. Benchmarks with AEGIS-256 show about 6% read and 14% write latency overhead on larger databases and under 3% on total runtime, with key derivation, rekeying and encrypting existing databases still planned.