Back to browse
GitHub Repository

Zero-allocation, panic-free decimal arithmetic for HFT-grade Go. No big.Int, no GC pressure, fastest in its class.

5 starsGo

I vibe coded the fastest Decimal Go lib

by alexandroskyr·Jun 12, 2026·1 point·0 comments

AI Analysis

●●●BangerWizardryBig Brain

Reciprocal division trick beats udecimal by 35% with zero heap allocations.

Strengths
  • Möller–Granlund 2-by-1 division replaces hardware DIV with precomputed magics
  • testing.AllocsPerRun gates enforce zero allocations on every code path
  • Differential fuzz testing against shopspring/decimal proves bit-exact correctness
Weaknesses
  • 128-bit coefficient limits precision to 39 digits, may not suit all domains
  • Requires Go 1.26+, excludes users on older LTS versions
Target Audience

Go developers building latency-critical systems (HFT, trading, billing)

Similar To

shopspring/decimal · quagmt/udecimal

Post Description

A zero-allocation Go decimal library with no big.Int fallback — 128-bit fixed-point arithmetic that benchstats ~35% faster than the fastest existing library, with exact alloc counts and overflow correctness enforced by the test suite.

The fun part was making it fast: every division by a power of ten (rescaling, rounding, formatting) is done with precomputed multiply-high reciprocals instead of hardware DIV — the Möller–Granlund 2-by-1 trick plus magic constants, all generated and re-proven against big.Int. On my M1 Pro it benchstats ~35% faster (geomean) than udecimal, the fastest library I could find, and ~9x faster than shopspring.

How: Claude Code with Ultracode + Fable 5 for 12hours

Similar Projects

GamingMid

Purely Vibe Coded Asmongold Simulator

This is a focused gag-with-mechanics: on-stream vs off-stream loops, 3-second game hours, chatters with ban/non-ban outcomes, an action queue, and even an economy with brutal 65% projected taxes. It nails the specific streamer-parody niche with concrete systems (mini combat, passive heal scaling, random events like the Trump cameo), but it's more playful craft than technical novelty — the screenshot showing a 403 page also hurts first impressions and discoverability.

Niche GemRabbit Hole
spirodonfl
104mo ago