---
title: "Leveraging Rust and the GPU to render user interfaces at 120 FPS"
description: "Zed's GPUI framework hits 120 FPS by rendering the editor UI like a video game: rather than a general-purpose 2D vector renderer (Pathfinder proved too slow), it uses dedicated GPU shaders for a small set of primitives such as rectangles, shadows, text, icons and images, all described as data on the CPU and drawn with instanced rendering."
url: "https://swe.quest/articles/leveraging-rust-and-the-gpu-to-render-user-interfaces-at-120-fps-8175e9071db5a167"
canonical: "https://zed.dev/blog/videogame"
source: "Zed"
published: "2023-03-07"
difficulty: "hard"
kind: "Deep dive"
reading_minutes: 16
tags: ["performance","rust","frontend","hardware","developer-tools"]
---

# Leveraging Rust and the GPU to render user interfaces at 120 FPS

A post on [Zed](https://swe.quest/sources/zed.md), published 2023-03-07, 16 min read, Deep dive. Original: [https://zed.dev/blog/videogame](https://zed.dev/blog/videogame)

## Summary

Zed's GPUI framework hits 120 FPS by rendering the editor UI like a video game: rather than a general-purpose 2D vector renderer (Pathfinder proved too slow), it uses dedicated GPU shaders for a small set of primitives such as rectangles, shadows, text, icons and images, all described as data on the CPU and drawn with instanced rendering. Rounded rectangles come from a signed distance function evaluated in a Metal fragment shader. Drop shadows follow Evan Wallace's approximation, which pairs a closed-form erf-based Gaussian convolution on one axis with a few samples along the other. Text uses OS shaping via CoreText, with a per-frame cache of text-font pairs so only changed text gets reshaped.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Rust](https://swe.quest/tags/rust.md) (Languages)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [Hardware](https://swe.quest/tags/hardware.md) (Infrastructure)
- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)

## Prerequisites

- GPU vertex and fragment shaders ([easy posts on Hardware](https://swe.quest/tags/hardware.md?difficulty=easy))
- basic linear algebra
- text shaping and rasterization concepts

## Keywords

GPUI, Zed, Metal Shading Language, signed distance functions, CoreText, Pathfinder, Gaussian blur

## Related posts

- [Zed Weekly: #29](https://swe.quest/articles/zed-weekly-29-41f27bba860d0170.md): Zed · 2023-12-15 · Medium · 6 min read · Rust, Memory management, Performance engineering, Frontend, Developer tools
  Zed's port to GPUI 2 is nearing daily usability, and the team is focused on frame-rendering performance measured by holding tab-switch at 60Hz key repeat.
- [Optimizing the Metal pipeline to maintain 120 FPS in GPUI](https://swe.quest/articles/optimizing-the-metal-pipeline-to-maintain-120-fps-in-gpui-951f2f761e0fc50d.md): Zed · 2024-02-07 · Medium · 9 min read · Performance engineering, Frontend, Rust, Hardware, Debugging
  Zed's GPUI renderer dropped frames on Macs running in direct (non-composited) mode because \`MetalRenderer::draw\` blocked the main thread with \`wait\_until\_completed\`.
- [Zed Weekly: #22](https://swe.quest/articles/zed-weekly-22-1c922abde503e316.md): Zed · 2023-10-06 · Easy · 7 min read · Developer tools, Rust, Real-time systems, Product engineering
  Zed team members report weekly progress: GPUI is being rewritten with a ported Metal renderer that uses plane-split for primitive draw ordering, multi-threaded entity access, and a MainThread\<T: Context\> wrapper so native UI APIs are only called from the main thread.
- [The Future of React Native Graphics: WebGPU, Skia, and Beyond](https://swe.quest/articles/the-future-of-react-native-graphics-webgpu-skia-and-beyond-c599058475fc1e90.md): Shopify Engineering · 2025-06-20 · Easy · 7 min read · React, Mobile, Performance engineering
  React Native WebGPU, built on Google's Dawn, lets React Native apps run Three.js, React Three Fiber, TSL shaders, ComputeToys compute shaders and TensorFlow.js on Metal (iOS) and Vulkan (Android) with no changes, which collapses the separate OpenGL and Metal backends into one.
- [Linux when?](https://swe.quest/articles/linux-when-b4f56402c8f35e78.md): Zed · 2024-05-07 · Medium · 12 min read · Rust, Linux, Frontend, Open source, Developer tools
  Zed's Linux port works by implementing GPUI's platform-agnostic \`Platform\` and \`PlatformWindow\` traits for Linux.

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)
