---
title: "Supporting faster file load times with memory optimizations in Rust"
description: "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."
url: "https://swe.quest/articles/supporting-faster-file-load-times-with-memory-optimizations-in-rust-9b748f81216508a0"
canonical: "https://www.figma.com/blog/supporting-faster-file-load-times-with-memory-optimizations-in-rust/"
source: "Figma"
published: "2025-06-18"
difficulty: "medium"
kind: "Case study"
reading_minutes: 6
tags: ["rust","memory-management","performance","data-structures","realtime"]
---

# Supporting faster file load times with memory optimizations in Rust

A post on [Figma](https://swe.quest/sources/figma.md), published 2025-06-18, 6 min read, Case study. Original: [https://www.figma.com/blog/supporting-faster-file-load-times-with-memory-optimizations-in-rust/](https://www.figma.com/blog/supporting-faster-file-load-times-with-memory-optimizations-in-rust/)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Rust](https://swe.quest/tags/rust.md) (Languages)
- [Memory management](https://swe.quest/tags/memory-management.md) (Compilers & runtimes)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Data structures](https://swe.quest/tags/data-structures.md) (Architecture & design)
- [Real-time systems](https://swe.quest/tags/realtime.md) (Backend & APIs)

## Prerequisites

- Rust collections ([easy posts on Rust](https://swe.quest/tags/rust.md?difficulty=easy))
- CPU cache locality ([easy posts on Hardware](https://swe.quest/tags/hardware.md?difficulty=easy))
- pointer representation

## Keywords

Figma, BTreeMap, Rust, pointer tagging, resident set size

## Related posts

- [Improving performance in the layers panel](https://swe.quest/articles/improving-performance-in-the-layers-panel-1cd0d897a08e1393.md): Figma · 2026-06-11 · Medium · 8 min read · Performance engineering, Frontend, Caching, Data structures
  Figma rebuilt its layers panel to fix two problems: it computed data for every expanded node, and it recomputed everything after any change.
- [The effect of switching to TCMalloc on RocksDB memory use](https://swe.quest/articles/the-effect-of-switching-to-tcmalloc-on-rocksdb-memory-use-97e46a9ddc75be5e.md): Cloudflare · 2021-02-03 · Medium · 8 min read · Memory management, Performance engineering, Linux, Storage engines
  Quicksilver's memory roughly doubled after its storage moved to RocksDB, climbing from about 15GB to 30GB over several days.
- [We Have to Start Over: From Atom to Zed](https://swe.quest/articles/we-have-to-start-over-from-atom-to-zed-8db3be76f03d8a79.md): Zed · 2024-02-12 · Easy · 25 min read · Rust, Developer tools, Performance engineering, Data structures
  Zed's co-founders explain why they abandoned Atom's Electron/JavaScript stack and rebuilt a code editor in Rust: JavaScript's pointer-chasing arrays, uncontrollable GC pauses, and the costly JS/C++ boundary for multithreading made performance work feel like fighting the platform.
- [iddqd, or the hardest kind of unsafe Rust](https://swe.quest/articles/iddqd-or-the-hardest-kind-of-unsafe-rust-50456dacfa60840a.md): Oxide · 2026-06-02 · Hard · 23 min read · Rust, Memory safety, Data structures
  iddqd is a Rust map library, used in Oxide's Omicron control plane, where keys are borrowed from the values themselves.
- [This Week at Zed Industries: #1](https://swe.quest/articles/this-week-at-zed-industries-1-0d07c1f998ae465c.md): Zed · 2023-01-23 · Medium · 4 min read · Developer tools, Performance engineering, Data structures, Rust
  Zed grew out of Xray, the experimental editor Nathan Sobo and Antonio worked on at GitHub in 2018, and this weekly update recaps the path from there to a company and a private alpha.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
