editor: Improve minimap performance (#33067)
This PR aims to improve the minimap performace. This is primarily achieved by disabling/removing stuff that is not shown in the minimal as well as by assuring the display map is not updated during minimap prepaint. This should already be much better in parts, as the block map as well as the fold map will be less frequently updated due to the minimap prepainting (optimally, they should never be, but I think we're not quite there yet). For this, I had to remove block rendering support for the minimap, which is not as bad as it sounds: Practically, we were currently not rendering most blocks anyway, there were issues due to this (e.g. scrolling any visible block offscreen in the main editor causes scroll jumps currently) and in the long run, the minimap will most likely need its own block map or a different approach anyway. The existing implementation caused resizes to occur very frequently for practically no benefit. Can pull this out into a separate PR if requested, most likely makes the other changes here easier to discuss. This is WIP as we are still hitting some code path here we definitely should not be hitting. E.g. there seems to be a rerender roughly every second if the window is unfocused but visible which does not happen when the minimap is disabled. While this primarily focuses on the minimap, it also touches a few other small parts not related to the minimap where I noticed we were doing too much stuff during prepaint. Happy for any feedback there aswell. Putting this up here already so we have a place to discuss the changes early if needed. Release Notes: - Improved performance with the minimap enabled. - Fixed an issue where interacting with blocks in the editor would sometimes not properly work with the minimap enabled.
This commit is contained in:
parent
363a265051
commit
26ba6e7e00
12 changed files with 207 additions and 184 deletions
|
@ -37,6 +37,48 @@ development build, run Zed with the following environment variable set:
|
|||
ZED_DEVELOPMENT_USE_KEYCHAIN=1
|
||||
```
|
||||
|
||||
## Performance Measurements
|
||||
|
||||
Zed 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.
|
||||
|
||||
### Using ZED_MEASUREMENTS
|
||||
|
||||
To enable performance measurements, set the `ZED_MEASUREMENTS` environment variable:
|
||||
|
||||
```sh
|
||||
export ZED_MEASUREMENTS=1
|
||||
```
|
||||
|
||||
When enabled, Zed will print frame rendering timing information to stderr, showing how long each frame takes to render.
|
||||
|
||||
### Performance Comparison Workflow
|
||||
|
||||
Here's a typical workflow for comparing frame rendering performance between different versions:
|
||||
|
||||
1. **Enable measurements:**
|
||||
|
||||
```sh
|
||||
export ZED_MEASUREMENTS=1
|
||||
```
|
||||
|
||||
2. **Test the first version:**
|
||||
|
||||
- Checkout the commit you want to measure
|
||||
- Run Zed in release mode and use it for 5-10 seconds: `cargo run --release &> version-a`
|
||||
|
||||
3. **Test the second version:**
|
||||
|
||||
- Checkout another commit you want to compare
|
||||
- Run Zed in release mode and use it for 5-10 seconds: `cargo run --release &> version-b`
|
||||
|
||||
4. **Generate comparison:**
|
||||
|
||||
```sh
|
||||
script/histogram version-a version-b
|
||||
```
|
||||
|
||||
The `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.
|
||||
|
||||
## Contributor links
|
||||
|
||||
- [CONTRIBUTING.md](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue