Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Figma 14 min read Case study mediumAdept

Keeping Figma fast

Figma replaced its single-MacBook performance testing setup with two systems sharing one CI scheduler. The first runs end-to-end tests in headless Chromium on GPU-enabled cloud VMs for every pull request, finishes within 10 minutes through parallel runs, and uses a 20% pass margin to catch large regressions despite VM noise. The second is a small fleet of older real laptops for on-demand runs such as bisecting subtle regressions and benchmarking hot-path optimizations. Instruction counting and a full device farm were rejected because Figma's WASM/WebGL workload is bound variously by CPU, GPU and I/O. Case studies show the setup validating rendering time-slicing that prioritizes local edits over remote multiplayer changes, improving perceived frame rate on slow devices.

Assumes: CI pipelinesbrowser rendering basicsperformance profiling

Related posts

  • Figma rendering: Powered by WebGPU

    Figma mediumAdept

    Figma migrated its C++ renderer from WebGL to WebGPU while keeping WebGL as a fallback, first refactoring its graphics interface to pass draw-call state explicitly and to batch uniform uploads into a single buffer per submit to avoid performance regressions. Legacy WebGL 1 GLSL shaders are kept and automatically translated to WGSL via a custom shader processor plus naga, and Dawn is used for both the Emscripten/Wasm build and native server-side builds. Because WebGPU only supports asynchronous readback and can fail mid-session on Windows, Figma built a dynamic fallback that swaps backends to WebGL at runtime and blocklists devices by fallback rate. Benchmarks across Windows, Mac and ChromeOS showed gains on some device classes and neutral results elsewhere with no regressions, and compute shaders, MSAA and RenderBundles are next.

  • How Figma draws inspiration from the gaming world

    Figma easyNovice

    Figma's architecture resembles a game engine more than a typical web stack: a C++ canvas compiled to WebAssembly for 2D rendering, a React/TypeScript UI layer, and a Rust multiplayer server, plus layered systems for multiplayer, animation, collisions, chat and plugins. Because these systems are interdependent, bugs cross boundaries; a layout change from six months earlier made FigJam connectors oscillate between clients, flooding multiplayer messages and overloading autosave. Making FigJam tables collaborative without locking required resolving concurrent edits and adding an animation system so observers can follow row and column moves.

  • Speeding up file load times, one page at a time

    Figma mediumAdept

    Figma extended dynamic page loading from view-only files and prototypes to editable files, cutting load times for the slowest 5% of loads by 33% and reducing client memory. Editing requires write dependencies as well as read dependencies. These are the inverse edges that let an edit to a component, style or variable propagate to cached derived data on instances and auto layout frames, which may sit on unloaded pages. The QueryGraph dependency framework in the multiplayer server became a bidirectional graph with explicit foreign-key edges and implicit edges such as auto layout. The server uses it to compute each session's reachable subset as collaborators edit, and a shadow-mode validator flagged edits outside the computed write set, uncovering missed cross-page dependencies before launch.

  • Improving performance with incremental frame loading

    Figma mediumAdept

    Figma's prototype player used to load entire documents into memory, causing multi-minute loads and crashes on memory-constrained mobile devices. Incremental frame loading now fetches only the current screen and its directly reachable neighbors, built on a subscription protocol (query/reply/changes messages) that syncs subtrees of the document in real time, transitively subscribes to dependencies like components, styles and variables, and evicts unsubscribed nodes so nothing goes stale. Desktop clients keep loading remaining screens in the background while mobile clients load on navigation and evict old screens. Main-thread lockups were reduced by chunking loads and skipping layout and boolean computation for screens that aren't visible.

  • The evolution of Figma’s mobile engine: Compiling away our custom programming language

    Figma mediumAdept

    Figma migrated its prototype viewer's mobile engine from Skew, an in-house compile-to-JavaScript language, to TypeScript using a custom Skew-to-TypeScript transpiler and a three-phase rollout (write/build Skew, write Skew/build TypeScript, write/build TypeScript) that never paused development. The move became viable once mobile WebAssembly support let hot paths move to the C++ engine, removing the need for Skew's optimizing compiler. Transpiler pitfalls included slow JavaScript array destructuring (direct indexing improved per-frame latency by up to 25%), behavior differences from Skew's devirtualization that broke Smart Animate on null receivers, and TypeScript's initialization-order rules. Source maps were maintained so developers could keep debugging throughout.

The quest for software engineering knowledge.

Look:
Layout: