memujo
Gaming9 min read

Roblox Runs in Chrome: The 250x Fiber Switch Math

Roblox's Web Play beta squeezes a 20-year C++ engine into Chrome with JSPI fibers that switch 14x faster and use 1/70th the memory of threads.

By Alice

In this article
  1. 01Context: What Web Play Actually Ships
  2. 02Details: A Deadlock, Two Failed Designs, and JSPI
  3. 03The Benchmark Table, Read as an Engineer
  4. 04The 17 KB Leak That Crashed macOS
  5. 05Why This Matters: The Funnel, Not the Framework
  6. 06Outlook

The biggest gaming platform on earth just deleted its most important conversion step. On December 1, 2026, Roblox began rolling out Web Play, a public beta that lets players launch games directly inside Chrome on Windows, macOS, and Android with no app download. A "Play in browser" button now appears on game pages for accounts that have the beta, and Roblox's engineering newsroom says more browsers will follow over the next few months.

The consumer headline is convenience. The engineering headline is stranger and far more interesting: Roblox took a roughly 20-year-old C++ game engine, compiled it to WebAssembly, and taught it to multitask inside a runtime that forbids waiting. The trick, documented in detail by principal software engineer Fatih Bakır, is a fiber scheduler built almost entirely out of JavaScript Promises on top of Chrome's JavaScript Promise Integration (JSPI). Roblox's own measurements say the approach switches context about 14x faster and uses about 1/70th the memory of the thread-based alternative. Without it, Bakır writes plainly, "this web client would not have worked."

For anyone who builds concurrent systems, this is a rare public artifact: a production engine rewrite where the team published the failed attempts, the deadlock, the memory leak that crashed an operating system, and the benchmark table that settled the design choice.

Context: What Web Play Actually Ships

The beta is gradual and deliberately narrow. Per Roblox's announcement and the developer forum notes summarized by MLQ.ai, the supported devices are Windows PCs and Intel Macs with at least a 5th-generation Intel Core i5 (2015) or better, any Apple Silicon Mac, and Android phones in the class of the Redmi A5, Galaxy A15 5G, Galaxy S10, or Pixel 6. Chrome on iPhone is excluded because iOS browsers run on Apple's WebKit engine, and Edge is not supported yet, though a Roblox staff member told the developer forum that adding Edge "should be easy" once testing is done, as Beebom reports.

The feature cut list is honest about the beta label: voice chat, party chat, Friends Chat, Dynamic Heads through Self View, in-game video playback, video ads, image and Moments capture, haptics, in-game avatar switching, and remote MicroProfiler captures are all off in the browser. Known issues include music cutting out, hitching when entering new areas, higher memory use than the installed app, and Chrome on Windows sometimes picking the integrated GPU over a discrete one.

That is the product surface. The real story is underneath it.

Details: A Deadlock, Two Failed Designs, and JSPI

Roblox's engine assumes it can block. Threads can wait on a lock or a network reply and the operating system simply schedules something else. WebAssembly assumes the opposite: a Wasm call runs to completion, and anything asynchronous must be expressed as a Promise that returns immediately. The first time the team ran the Wasm build, it froze at startup. The engine requested config flags over HTTP and waited for the reply, but the reply could not be delivered until the engine handed control back to the browser, which could not happen until the reply arrived. A textbook deadlock.

Three rewrites were on the table, and the post is candid about the first two:

  1. Asyncify, an Emscripten pass that rewrites every function so it can pause and resume itself. It works for small programs. On the Roblox engine it produced code bloat and slowdown the team could not overcome.
  2. One Web Worker per fiber. JavaScript threads as real threads, each sleeping until woken. This got the client all the way into game-join on a high-end MacBook, then ran out of memory on an Android device.
  3. JSPI fibers. Chrome's JavaScript Promise Integration lets a Wasm function call a JavaScript function that returns a Promise and suspend the entire Wasm call stack until that Promise resolves. The browser sets the stack aside, returns control to the caller, and resumes exactly where it left off. From the C++ side it looks like an ordinary blocking call.

The third design won, and the implementation is remarkably small. A fiber suspends by creating a Promise and stashing its resolve function in a JavaScript array instead of calling it. Resuming a fiber means calling that stashed resolve. Switching fibers is "wake target, then pause," with a shadow stack pointer (__stack_pointer) swapped per fiber because Wasm's own execution stack has no addresses to save. New fibers are wrapped in a trampoline that suspends as its first act, so an eager fiber that immediately suspends is indistinguishable from one that starts suspended.

Bakır's summary of the scope is the line to remember: JSPI allows a few dozen lines of JavaScript to implement the core fiber API of create, swap_context, and destroy, while twenty years of engine code "still gets to wait, even on a web page."

The Benchmark Table, Read as an Engineer

Roblox published a direct comparison of its JSPI fiber implementation against the thread-backed (Web Worker) approach, from its own in-house tests:

Operation Thread-backed JSPI fibers Roblox-reported gain
Context switch ~2.6 µs ~0.18 µs ~14x faster
Create a fiber ~5 ms ~20 µs ~250x faster
Destroy a fiber ~50 µs ~1.3 µs ~35x faster
Memory per fiber ~3.1 MB ~44 KB ~70x smaller

These are vendor numbers, not independent benchmarks, and they compare two of Roblox's own implementations rather than JSPI against some external baseline. That caveat stated, the internal consistency is what makes them credible, and two of the rows explain decisions that otherwise look arbitrary.

Why creation speed matters more than switch speed. A 250x gap on fiber creation (~5 ms versus ~20 µs) sounds like the headline, but the engineering consequence is subtler. If creating a fiber costs milliseconds, you pool and reuse them, which means long-lived fibers holding their stacks, which means memory scales with peak concurrency instead of current concurrency. At 20 microseconds, fibers become cheap enough to create per task and destroy on exit, which is exactly the lifecycle the engine's code already expected.

The Android memory math is the real filter. At ~3.1 MB per fiber, a thread-backed client carrying even 100 live fibers spends roughly 310 MB on stacks alone before the game loads a single asset. On a Galaxy A15-class phone, that is most of the memory a browser tab can reasonably claim. At ~44 KB per fiber, the same 100 fibers cost about 4.4 MB, a rounding error. The Web Worker approach did not fail because threads are slow; it failed because thread stacks are sized for operating systems, not for a browser tab on a $150 phone. The 70x memory row, not the 14x switch row, is what killed design number two.

Frame budget sanity check. A 60 FPS frame is 16.6 ms. At 2.6 µs per switch, a hundred context switches per frame burn about 0.26 ms, already tolerable; the switch cost difference alone would not have justified the rewrite. The numbers only make sense as a package: cheap creation plus small stacks plus acceptable switching is what makes a fiber-per-task architecture viable in a browser.

The 17 KB Leak That Crashed macOS

The most instructive passage in the post is the bug hunt. After shipping the first fiber teardown, Roblox noticed the tab's memory kept growing even with a stable fiber count. On Android it caused crashes. On a Mac running macOS Tahoe, the browser ran the system out of page table entries and kernel-panicked the host OS, from a web page.

The cause: Chromium keeps a suspended JSPI stack alive even when nothing can ever resume it. Every destroyed fiber leaked 17 KB of pages the browser never returned to the operating system. Dropping the JavaScript reference, the normal fix, did nothing, because the engine held the stack, not the garbage collector.

The fix is the kind of hack that only survives code review when the alternative is a full rewrite. To destroy a fiber, Roblox wakes it one final time with a self-destruct flag, and the fiber executes __builtin_trap(), which compiles to Wasm's unreachable instruction. No C++ catch (...) can swallow it, deliberately, because a random catch-all in a 20-year-old engine could. The stack unwinds violently back to JavaScript, the browser releases the JSPI stack, and the memory goes back to the OS. Exceptions as garbage collection triggers, in a game engine, on the web. Bakır even supplies the punchline: "Who said exceptions are useless in game development?"

Why This Matters: The Funnel, Not the Framework

Two implications deserve the attention of anyone shipping games or rich apps.

First, the distribution math. Every step between a link click and a playable session is where casual players evaporate, and the app install is the single largest of those steps. We ran the same arithmetic on the other end of the spectrum in our GTA 6 distribution analysis: a 212 GB install is a launch-day event measured in petabytes. Roblox is playing the opposite game. Its install is small, but it is still a gate on Chromebooks in schools, on borrowed devices, and on machines where IT policy blocks installs. Web Play removes the gate entirely, and the minimum-spec list (a 2015-era Core i5 or a Redmi A5) shows Roblox is targeting the long tail of hardware, not the flagship. Compare that with console platforms adding monthly cloud gaming caps: the industry's two answers to friction are streaming from someone else's server or compiling the engine to run on the user's own hardware. Roblox just bet on the second, and it is the only one that scales without a datacenter subsidy per player-hour.

Second, JSPI just got a flagship proof point. The feature has existed in Chrome since 2024, but most Wasm ports dodge blocking code with Asyncify or rearchitect around it. Roblox is the highest-profile case of a large legacy C++ codebase kept intact by suspending at the boundary instead. Expect follow-on ports of engines, CAD tools, and legacy middleware to cite this post, and expect the leak class Roblox found (browser-held stacks that outlive their owners) to show up in other JSPI adopters before Chrome fixes it centrally.

Outlook

The beta's shape tells you the roadmap: Chrome first because JSPI is Chrome's, Edge "should be easy" once tested, iOS blocked by WebKit policy rather than engineering, and the feature gaps (voice chat, video, haptics) reading like a list of native APIs that have no browser equivalent yet, not like bugs. The rollout is described as gradual over the next couple of months, so the interesting dates are the next two: when Edge ships, and whether WebKit ever enables JSPI, which is the only thing standing between this beta and a genuinely universal web client.

The durable takeaway is not that Roblox runs in Chrome. It is that the company published a benchmark table showing a few dozen lines of Promise plumbing beat real threads by 70x on memory, and that the difference between a web client that works and one that "ran out of memory on an Android device" was 3 MB per fiber. Concurrency primitives are back in fashion, and this time they fit in a browser tab.

  • #roblox
  • #webassembly
  • #jspi
  • #chrome
  • #web-gaming
  • #fibers
  • #concurrency

Sources

Share this story