Improving performance in the layers panel
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.
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.
- Version control: Three ways Figma explored horizontal scrolling
Figma mediumAdept
Adding horizontal scrolling to Figma's Layers panel was harder than expected because the list is virtualized (only visible rows render), rows are interactive (hide, lock, collapse, rename), and layer names vary in length. Three prototypes were rejected: sticky edge icons for out-of-view parents, which needed opaque backgrounds that clashed with the row structure; full auto-scroll to a selected layer, which disoriented users; and a rename text box that expanded while scrolling, which flickered because resizing was done in JavaScript. The shipped design leaves blank space above visible layers and resets an in-progress rename on scroll. It auto-scrolls only when a selected layer overflows the left edge by 50px or more, using an invisible render of unrendered rows to measure them for precise alignment.
- How we rebuilt the foundations of component instances
Figma mediumAdept
Figma replaced its decade-old Instance Updater, a self-contained runtime that resolved component instances and also did its own layout and variable evaluation, with Materializer, a generic framework for deriving subtrees of the document tree from feature-defined blueprints. Materializer uses push-based invalidation with automatic dependency tracking recorded during materialization. It was paired with a shared runtime orchestration layer that runs systems in a predictable order and eliminates "back-dirty" feedback loops. The rewrite was validated by running old and new runtimes side by side on hundreds of thousands of production files. Variable mode changes in large files got 40–50% faster, and Materializer now underpins rich text and slots.
- Supporting faster file load times with memory optimizations in Rust
Figma mediumAdept
Figma's Rust multiplayer server represented each file node as a BTreeMap from u16 property IDs to pointers, and memory profiling showed this map used over 60% of a file's memory. Because the schema has fewer than 200 fields and nodes average about 60 keys, the team swapped it for a flat sorted vector. Despite worse big-O complexity, the cache-friendly layout cut p99 deserialization time by 20% and fleet memory by about 20%. A further experiment stored the field ID in the unused top 16 bits of x86-64 pointers, saving only about 5% more RSS. That change was not shipped because of the risk of getting reference counts wrong and corrupting memory.
- 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.