1# Developing Zed
 2
 3See the platform-specific instructions for building Zed from source:
 4
 5- [macOS](./development/macos.md)
 6- [Linux](./development/linux.md)
 7- [Windows](./development/windows.md)
 8
 9If you'd like to develop collaboration features, additionally see:
10
11- [Local Collaboration](./development/local-collaboration.md)
12
13## Keychain access
14
15Zed stores secrets in the system keychain.
16
17However, when running a development build of Zed on macOS (and perhaps other
18platforms) trying to access the keychain results in a lot of keychain prompts
19that require entering your password over and over.
20
21On macOS this is caused by the development build not having a stable identity.
22Even if you choose the "Always Allow" option, the OS will still prompt you for
23your password again the next time something changes in the binary.
24
25This quickly becomes annoying and impedes development speed.
26
27That is why, by default, when running a development build of Zed an alternative
28credential provider is used in order to bypass the system keychain.
29
30> Note: This is **only** the case for development builds. For all non-development
31> release channels the system keychain is always used.
32
33If you need to test something out using the real system keychain in a
34development build, run Zed with the following environment variable set:
35
36```
37ZED_DEVELOPMENT_USE_KEYCHAIN=1
38```
39
40## Performance Measurements
41
42Zed includes a frame time measurement system that can be used to profile how long it takes to render each frame. This is particularly useful when comparing rendering performance between different versions or when optimizing frame rendering code.
43
44### Using ZED_MEASUREMENTS
45
46To enable performance measurements, set the `ZED_MEASUREMENTS` environment variable:
47
48```sh
49export ZED_MEASUREMENTS=1
50```
51
52When enabled, Zed will print frame rendering timing information to stderr, showing how long each frame takes to render.
53
54### Performance Comparison Workflow
55
56Here's a typical workflow for comparing frame rendering performance between different versions:
57
581. **Enable measurements:**
59
60   ```sh
61   export ZED_MEASUREMENTS=1
62   ```
63
642. **Test the first version:**
65
66   - Checkout the commit you want to measure
67   - Run Zed in release mode and use it for 5-10 seconds: `cargo run --release &> version-a`
68
693. **Test the second version:**
70
71   - Checkout another commit you want to compare
72   - Run Zed in release mode and use it for 5-10 seconds: `cargo run --release &> version-b`
73
744. **Generate comparison:**
75
76   ```sh
77   script/histogram version-a version-b
78   ```
79
80The `script/histogram` tool can accept as many measurement files as you like and will generate a histogram visualization comparing the frame rendering performance data between the provided versions.
81
82### Using `util_macros::perf`
83
84For benchmarking unit tests, annotate them with the `#[perf]` attribute from the `util_macros` crate. Then run `cargo
85perf-test -p $CRATE` to benchmark them. See the rustdoc documentation on `crates/util_macros` and `tooling/perf` for
86in-depth examples and explanations.
87
88## Contributor links
89
90- [CONTRIBUTING.md](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md)
91- [Debugging Crashes](./development/debugging-crashes.md)
92- [Code of Conduct](https://zed.dev/code-of-conduct)
93- [Zed Contributor License](https://zed.dev/cla)