Skip to content

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

Figma 8 min read Case study mediumAdept

Improving performance with incremental frame loading

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.

Assumes: real-time collaborative editing basicsbrowser main-thread constraints

Related posts

  • 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.

  • Keeping Figma fast

    Figma mediumAdept

    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.

  • Improving performance in the layers panel

    Figma mediumAdept

    Figma rebuilt its layers panel to fix two problems: it computed data for every expanded node, and it recomputed everything after any change. Splitting data gathering into two passes means full row data is computed only for the few dozen windowed rows. Modeling the row tree with lazy, cached derived properties (spreadsheet-like dependency tracking) means only the affected subtree recomputes. A rope-like recursive list for cached ordered children avoids O(n²) memory, cutting memory by up to 99%, and key interactions got 30–50% faster in large files, with smoother editing overall.

  • 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.

  • Macramé: Untangling the Knot on the Etsy Android Listing Screen

    Etsy Code as Craft mediumAdept

    Etsy rewrote its 4000-line Android listing Fragment into Macramé, a Mobius-inspired unidirectional architecture: a single immutable State exposed via StateFlow, flattened into small UI models rendered by a RecyclerView with ListAdapter diffing, and a sealed-class Event dispatcher routing actions to single-purpose Handlers that update State, launch async work, or emit SideEffects to the Fragment. The five-month rewrite cut Time to First Content by 18% (1585 ms to 1298 ms), lifted listing views, add-to-carts and searches in an A/B test, and raised business-logic unit test coverage from single digits to 76%. Remaining tradeoffs include Event/Handler wiring boilerplate, harder debugging of Handler-dispatched event chains, and overkill on simple screens.

The quest for software engineering knowledge.

Look:
Layout: