{
  "id": 569325,
  "title": "We ported JSBI to C++ — and the benchmark taught us more than the port did",
  "url": "https://urgent.news/2026/08/11/we-ported-jsbi-to-c-and-the-benchmark-taught-us-more-than-the-port-did",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-11T13:40:46.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/devanshkant/we-ported-jsbi-to-c-and-the-benchmark-taught-us-more-than-the-port-did-14c"
  },
  "original_language": "en",
  "account": "We ported GoogleChromeLabs/jsbi, a pure-JS arbitrary-precision integer library, to modern C++17 and bridged it back to Node via N-API for Port Mortem 2026 (Track H). The porting process itself was not the difficult part; ensuring identical behavior to the original and acknowledging the one place where this could not be proven proved to be the challenge. This story revolves around a compile error that turned out to be a correctness bug, a shared_ptr that claimed to own memory but didn't, and a benchmark that changed its results multiple times. JSBI is not a typical JavaScript library; it's V8's internal MutableBigInt, manually downgraded to 30-bit digits to accommodate JavaScript's 2^53 safe-integer ceiling without silently losing precision. The porting process was more about undoing a constraint rather than swapping languages. The verification pipeline involved running the original test suite unmodified, which required using a pinned submodule and a three-way differential fuzzer comparing the ported code against native V8 BigInt and the actual upstream jsbi npm package. Four bugs were identified during the process, ranging from a compile error hiding a correctness issue to a shared_ptr that falsely claimed ownership and a spec quirk that was not initially tested. These issues were discovered through careful debugging and a well-designed benchmark harness, ensuring that the ported library behaved identically to the original.",
  "summary": "TL;DR: We ported GoogleChromeLabs/jsbi — a pure-JS arbitrary-precision integer library — to modern C++17, bridged back to Node via N-API, for Port Mortem 2026 (Track H). The port itself wasn't the hard part. Proving it behaved identically to the original — and being honest about the one place we couldn't prove that — was. This is the story of a compile error that was secretly a correctness bug, a…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}