Why Twitter sends Tweet IDs as strings: JS doubles can only represent 53-bit integers
arpit_bhayani · x · 2026-10-26
Engineer arpitbhayani explains why the Twitter API delivers 64-bit Tweet IDs as strings:
- Twitter generates IDs with Snowflake, packing a timestamp, worker ID, and local sequence counter into 64 bits — great for time-sorting and coordination-free distributed generation.
- The problem is at the edge: JS JSON.parse treats numbers as double-precision floats, which can only exactly represent integers up to 53 bits, so 64-bit IDs get rounded and corrupted.
- Hence strings on the wire. JS workarounds exist but require extra parsing logic — and one wrong client re-corrupts the ID.
More from Infra
- Open-source Latch compiles PyTorch into training megakernels, 2.75x faster on H100 — sguada · 2026-10-27
- DeepSpeed shows AutoEP/AutoTP/AutoSP parallelism gains, hosts office hours — PyTorch · 2026-10-27
- Running a local 9B as a coding agent: brief the big model to plan, let the small model execute — Electrical_Ninja3805 · 2026-10-27
- Cloudflare Durable Objects validated as top architecture for AI agent WebSocket servers — tristanbob · 2026-10-27
- Gary Marcus: With Q3 data added, Anthropic's compute-efficiency growth shows deceleration — GaryMarcus · 2026-10-27
- SpaceX locks in $40B GPU financing deal with Apollo, the largest ever committed — TechCrunch AI · 2026-10-27