Skip to content

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

Figma 13 min read Case study mediumAdept

Speeding up file load times, one page at a time

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.

Assumes: dependency graphsreal-time collaborative editing

Related posts

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

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

  • Keeping it 100(x) with real-time data at scale

    Figma mediumAdept

    Figma rebuilt LiveGraph, its real-time GraphQL-like subscription service over Postgres, to scale reads and database update load 100x as the database moved from one instance to vertical and horizontal shards. The old design tailed a single globally ordered replication stream into per-server mutation-based caches, which caused excessive fan-in and fan-out, fragmented caches, thundering herds on deploy, and stalled optimistic updates whenever any shard blipped. Two traffic findings drove the redesign: most data is delivered by initial reads rather than live updates, and most queries can be invalidated directly from a row mutation. The result is a three-tier Go system: an edge that expands views, a read-through cache sharded by query hash, and stateless invalidators sharded like the databases that tail the replication streams and send invalidations only to the relevant cache shards.

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

  • From Intern Project to Production: How I Shipped the Draw Tool for Canva's Present Mode

    Canva Engineering mediumAdept

    Bringing Canva's editor draw tool into present mode required three fixes: extracting the editor-coupled draw logic into a new shared package with interfaces between shared classes and domain-specific implementations (Open/Closed Principle), normalizing stroke coordinates so drawings stay correctly positioned and scaled across Presenter View's presenter and audience windows, and lazy loading the draw tool with code splitting. The lazy loading cut the presentation load-time regression from 7% to 0.24%. The feature started as an intern proof of concept and now sees about 470K monthly active users.

The quest for software engineering knowledge.

Look:
Layout: