Why UI Performance Matters at Scale
Prime Video delivers video to over 200 million customers across a vast number of devices. At that scale, UI performance isn’t just a luxury—it’s a necessity. Inconsistent or slow UI rendering leads to:
-
Poor customer engagement
-
Lower retention and watch time
-
Increased customer support costs
In early 2024, Prime Video’s team shared how they tackled this challenge by replacing a core piece of their client-side JavaScript rendering engine with a custom-built Rust application.
✅ Result: A 7.6x reduction in latency and a significant decrease in startup time for UI components.
The Problem: JavaScript Reached Its Limits
-
Prime Video used a Web-based UI rendering engine, written in JavaScript, to render complex UI on set-top boxes and smart TVs.
-
This engine parsed declarative UI templates (similar to React) and generated views at runtime.
-
But performance suffered—especially on low-powered devices.
Challenges with JavaScript:
-
Garbage Collection: Non-deterministic pauses.
-
Startup Overhead: Interpreted language with longer initialization times.
-
CPU-bound Tasks: JavaScript struggled with performance-intensive rendering pipelines.
1. Rust’s Predictable Performance Eliminated Jank
Rust offers predictable, low-latency performance due to:
-
Ahead-of-time compilation
-
No garbage collector
-
Zero-cost abstractions
Prime Video found a 5.6x improvement in startup latency and up to 7.6x improvement in runtime performance after porting the JavaScript engine to Rust.
Why It Matters:
Rust avoids runtime unpredictability, which is key for real-time rendering.
2. Memory Safety Without GC Improved Throughput
Rust enforces memory safety at compile time—without a garbage collector.
-
This let engineers write high-performance code with fewer runtime crashes.
-
The new Rust engine had fewer memory leaks, improved cache performance, and better multithreading.
As a result, frame drops were reduced significantly on low-powered devices.
3. Multithreading Made Easier (and Safer)
JavaScript (especially in browsers or Node.js) is single-threaded by design.
Rust enabled Prime Video to parallelize work across CPU cores, including:
-
Parsing templates
-
Rendering UI trees
-
Fetching resources asynchronously
This parallelism was safe by design, thanks to Rust’s ownership model.
The team observed faster UI updates under load and improved responsiveness.
4. Better Developer Tooling with Cargo and Crates
Using Rust’s ecosystem, the team:
-
Integrated Cargo for deterministic builds
-
Used popular crates like
serdefor parsing andtokiofor async operations -
Built internal libraries shared across teams
This reduced build complexity and improved code maintainability.
5. Smaller Binary Sizes Boosted Load Times
Rust binaries, while statically compiled, can be smaller than JavaScript bundles + runtime engines.
-
Prime Video optimized the Rust codebase with LTO (Link-Time Optimization) and dead code elimination.
-
Load times improved significantly on bandwidth-limited devices.
Result: Reduced initial load times by over 50% in some cases.
6. Cross-Platform Compatibility Was Retained
Despite moving from JavaScript, they retained cross-platform UI support using:
-
Rust for the core engine
-
Thin platform-specific adapters (e.g., for Fire TV, Web, Smart TVs)
Rust was compiled to WebAssembly or native code depending on the platform.
7. Adopting Rust Led to a Culture Shift
The move to Rust wasn’t just technical—it was organizational.
-
Engineers upskilled in systems programming
-
The company invested in internal Rust education
-
There was greater discipline around error handling and performance debugging
The switch improved developer satisfaction and code quality across the team.
Prime Video migration Use Case
It takes lower than a minute to search out programmers singing praises for Rust on a web-based discussion board. Over the previous couple of years, Rust has been one of the crucial admired programming languages in Stack Overflow surveys.
Firms around the globe, similar to Atlassian, Discord, Figma, Meta, and Mozilla, have considerably benefited from implementing Rust in manufacturing. In truth, more than 90 companies throughout a variety of industries now depend on Rust for manufacturing immediately at varied ranges of their tech stack.
At QCon San Francisco final November, Alexandru Ene, a principal engineer at Amazon Prime Video, revealed that the corporate migrated the person interface for its lounge units to a unified Rust-based structure compiled to WebAssembly.
Beforehand, the app employed a twin tech stack: enterprise logic was developed in React and JavaScript, whereas low-level engine parts had been managed utilizing Rust and WebAssembly.
This migration has benefited Prime Video in a number of methods. Ene talked about that lots of the animations and clean web page transitions customers expertise within the app immediately are made potential by Rust—options that weren’t achievable with TypeScript and React on account of efficiency limitations.
For instance, the Prime Video app on a lower-end gadget skilled nearly 250 milliseconds of latency when transitioning from the principle web page to the gathering web page. With Rust, the latency dropped to 33 milliseconds. This represents over a 7 fold discount in latency.
Ene additionally showcased further parts and animations inside the app, where the latency was considerably decreased.
Ene stated that when the corporate constructed a prototype with React, it felt “a lot nicer and extra responsive”. “It simply satisfied folks immediately that it’s definitely worth the threat of constructing a UI in Rust and WebAssembly,” he stated.
It’s solely honest that Prime Video regarded it as a ‘threat’, contemplating that Rust is much from being well-liked or broadly explored for front-end improvement like React and JavaScript. So how did the group pull it off?
‘The Drawback Was JavaScript, So We Don’t Have That Anymore’
Earlier than the migration, the enterprise logic, together with the interface and person interactions, was developed utilizing React and JavaScript. In the meantime, performance-critical elements like rendering and animations had been dealt with by a low-level engine inbuilt Rust and WebAssembly, with some parts in C++.
These two layers communicated by means of a message bus, enabling the JavaScript aspect to ship instructions to the Rust engine to set off visible updates on the display screen. Whereas integrating Rust on this tech stack introduced “enormous features” within the fluidity of animations, it didn’t result in any enchancment in latency.

(Supply: Alexandru Ene’s presentation on the QCon San Francisco, November 2024.)
Prime Video then revamped the structure by constructing a Rust-based UI software program improvement equipment (SDK), which was compiled for WebAssembly for environment friendly cross-device deployment.
“The whole lot is now in Rust. It’s one single language. You don’t even have the message bus to fret about,” Ene stated. “The issue was JavaScript, so we don’t have that anymore.”
Nevertheless, he acknowledged that Rust lacks a considerable variety of libraries for UI programming and isn’t totally developed on this space but.
In response, Amazon Prime Video created a customized UI SDK impressed by React, SolidJS, and Leptos. It utilises ergonomic macros for named, non-obligatory arguments and makes use of reactive indicators, memos, and results to propagate updates.
The production-ready framework incorporates an entity part system (ECS) structure that separates UI knowledge from habits, important widgets, and occasion dealing with. The framework then compiles to WebAssembly, powering all the lounge units.
“We switched them (builders) with our Rust UI SDK with no loss in productiveness,” Ene stated.
Whereas Amazon appears to have cracked the code for utilizing Rust in UIs, promising efforts are underway to develop simpler frameworks and abstractions like these.
For instance, a venture named Are We GUI Yet? tracks Rust-native and cross-platform GUI options, highlighting bindings to present libraries and experimental Rust-based approaches and offering builders with a transparent overview of this rising ecosystem.
A 40x Pace Increase with Rust + WebAssembly Over JavaScript
That stated, a number of different builders have noticed that utilizing Rust and WebAssembly can improve the efficiency of JavaScript.
In a Medium article, Yuji Isobe, vp of engineering at NearMe, shared how he considerably enhanced JavaScript efficiency utilizing Rust and WebAssembly.
Isobe, initially skeptical in regards to the practicality of WebAssembly, experimented by rewriting a JavaScript-based ULID generator—a broadly used library for producing distinctive, sortable identifiers—in Rust after which compiling it to WebAssembly. This delivered outstanding outcomes, with the implementation executing roughly 40 occasions sooner than the unique JavaScript model.
Initially, the efficiency enchancment was about 10 occasions sooner, however Isobe enhanced the implementation additional by minimising pointless reminiscence allocation, precomputing repeated operations, and streamlining knowledge dealing with. With these enhancements, he extracted even better effectivity from the WebAssembly module.
“WASM’s (WebAssembly) velocity comes from its low-level binary format, easy reminiscence model, and ahead-of-time compilation. This minimises overhead, permitting efficiency near native code,” Isobe stated.
One other developer, Chris Biscardi, defined in a YouTube video how he constructed an online UI for his web site utilizing Rust and the executive UI for content material administration utilizing the Leptos framework.
Biscardi additionally revealed that he used Axum because the server framework for each the interface and the related API service. “The expertise is pretty much as good as any JavaScript-based website that I may have constructed, in my view,” he stated.
Conclusion: Should You Switch to Rust?
Prime Video’s results are compelling, but switching to Rust isn’t a silver bullet. Ask:
-
Do you have tight performance or memory constraints?
-
Are you deploying to embedded or constrained devices?
-
Is latency a major user experience driver?
️ Action Plan:
Audit your current UI pipeline latency.
Identify CPU-bound areas where GC stalls are common.
Prototype critical paths in Rust (or Rust + WebAssembly).
Train your team on Rust’s ownership model and tooling.