From a359a5a1f248616f4bece8d082fab0c6fe60cc9c Mon Sep 17 00:00:00 2001 From: David Kleingeld Date: Tue, 25 Nov 2025 13:49:27 +0100 Subject: [PATCH] Add performance doc (#43265) Release Notes: - N/A --- docs/src/SUMMARY.md | 1 + docs/src/performance.md | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 docs/src/performance.md diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index dc42cfbdbb89d06162016f8ec2548ad630d20bc9..7425e77fb42af3922ca50fbb8fae7cd8f75d9313 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -167,6 +167,7 @@ - [FreeBSD](./development/freebsd.md) - [Local Collaboration](./development/local-collaboration.md) - [Using Debuggers](./development/debuggers.md) + - [Performance](./performance.md) - [Glossary](./development/glossary.md) - [Release Notes](./development/release-notes.md) - [Debugging Crashes](./development/debugging-crashes.md) diff --git a/docs/src/performance.md b/docs/src/performance.md new file mode 100644 index 0000000000000000000000000000000000000000..bcd9da1a59533469758d309cb19b8dec30bab012 --- /dev/null +++ b/docs/src/performance.md @@ -0,0 +1,32 @@ +How to use our internal tools to profile and keep Zed fast. + +# Tracy + +Get a profile of the zed foreground executor + +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: + +- Clone the repo at git@github.com:zed-industries/tracy.git on v0.12.2 branch +- `cd profiler && mkdir build && cd build` +- Run cmake to generate build files: `cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..` +- Build the importer: `ninja` +- Run the impoter 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 output.tracy` +- Go to 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 + +```rust +let _timer = zlog::time!("my_function_name").warn_if_gt(std::time::Duration::from_millis(100)); +```