zed/docs/src/performance.md
morgankrey 6daa541e77
docs: Apply documentation standards across all docs (#49177)
## Summary

Comprehensive remediation of 146 documentation files to align with Zed's
documentation conventions and brand voice guidelines.

## Changes

### YAML Frontmatter
- Added `title` and `description` frontmatter to all docs missing it

### Settings UI Pattern
- Updated 48+ files to show Settings Editor before JSON examples
- Pattern: `Configure X in Settings ({#kb zed::OpenSettings}), or add to
your settings file:`
- Added `([how to edit](./configuring-zed.md#settings-files))` links for
JSON-only settings

### Brand Voice Fixes
- Removed exclamation points (command-palette, key-bindings, repl,
privacy-and-security, etc.)
- Simplified em dash chains to parentheticals (environment,
troubleshooting, agent-panel, etc.)
- Fixed marketing language (yarn.md intro, development/linux.md)

### Terminology Alignment
- `settings UI` -> `Settings Editor`
- `sidebar` -> specific panel names (Project Panel, Collab Panel)
- `directory` -> `folder` in non-technical contexts
- `workspace` -> `project` in non-LSP contexts
- `Command Palette` -> `command palette` (lowercase)

### Callout Standardization
- Converted various callout formats to standard `> **Note:**` pattern

## Related

Depends on conventions established in #49176.

Release Notes:

- N/A
2026-02-17 20:58:17 -06:00

4.4 KiB

title description
Rough quick CPU profiling (Flamechart) Performance profiling and optimization for Zed development.

How to use our internal tools to profile and keep Zed fast.

Rough quick CPU profiling (Flamechart)

See what the CPU spends the most time on. Strongly recommend you use samply. It opens an interactive profile in the browser (specifically a local instance of firefox_profiler).

See samply's README on how to install and run.

The profile.json does not contain any symbols. Firefox profiler can add the local symbols to the profile for for. To do that hit the upload local profile button in the top right corner.

image

In depth CPU profiling (Tracing)

See how long each annotated function call took and its arguments (if configured).

Annotate any function you need appear in the profile with instrument. For more details see tracing-instrument:

#[instrument(skip_all)]
fn should_appear_in_profile(kitty: Cat) {
    sleep(QUITE_LONG)
}

Then either compile Zed with ZTRACING=1 cargo r --features tracy --release. The release build is optional but highly recommended as like every program Zeds performance characteristics change dramatically with optimizations. You do not want to chase slowdowns that do not exist in release.

One time Setup/Building the profiler:

Download the profiler: linux x86_64 macos aarch64

Alternative: Building it yourself

  • Clone the repo at git@github.com:wolfpld/tracy.git
  • cd profiler && mkdir build && cd build
  • Run cmake to generate build files: cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..
  • Build the profiler: ninja
  • [Optional] move the profiler somewhere nice like ~/.local/bin on linux

Usage

Open the profiler (tracy-profiler), you should see zed in the list of Discovered clients click it. image

To find functions that take a long time follow this image: image

Task/Async profiling

Get a profile of the zed foreground executor and background executors. Check if anything is blocking the foreground too long or taking too much (clock) time in the background.

The profiler always runs in the background. You can save a trace from its UI or look at the results live.

Setup/Building the importer:

Download the importer linux x86_64 mac aarch64

Alternative: Building it yourself

  • Clone the repo at git@github.com:zed-industries/tracy.git on v0.12.2 branch
  • cd import && mkdir build && cd build
  • Run cmake to generate build files: cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..
  • Build the importer: ninja
  • Run the importer on the trace file: ./tracy-import-miniprofiler /path/to/trace.miniprof /path/to/output.tracy
  • Open the trace in tracy:
    • If you're on windows download the v0.12.2 version from the releases on the upstream repo
    • If you're on other platforms open it on the website: https://tracy.nereid.pl/ (the version might mismatch so your luck might vary, we need to host our own ideally..)

To Save a Trace:

  • Run the action: zed open performance profiler
  • Hit the save button. This opens a save dialog or if that fails to open the trace gets saved in your working directory.
  • Convert the profile so it can be imported in tracy using the importer: ./tracy-import-miniprofiler <path to performance_profile.miniprof> output.tracy
  • Go to https://tracy.nereid.pl/ hit the 'power button' in the top left and then open saved trace.
  • Now zoom in to see the tasks and how long they took

Warn if function is slow

let _timer = zlog::time!("my_function_name").warn_if_gt(std::time::Duration::from_millis(100));