# gpui: Add bare bones benchmark framework \(\#58191\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/aa6f03bedd562374d55003608357d313e3cafe05)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: aa6f03bedd562374d55003608357d313e3cafe05

Requested commit: aa6f03bedd562374d55003608357d313e3cafe05

Commit: aa6f03bedd562374d55003608357d313e3cafe05

Tree: f1bc6966af4a3aa45c25e0d81cae7bdfe9f3a9b1

Author: Anthony Eid

Committer: GitHub

## Message

```
gpui: Add bare bones benchmark framework (#58191)

### Summary

Adds the first pass at `#[gpui::bench]`, backed by Criterion, with a new
`BenchAppContext` for GPUI benchmarks.

This ports one editor benchmark to the new setup while keeping the
existing Criterion render benchmarks in place.

### Follow Ups

I eventually want to improve this framework to create custom tracy
profiles that includes additional information such as
- notify count
- entity.update count and time
- event emitted and time for that

I also want to use this to create custom measurements so benches can be
used for
- Frames dropped 
- foreground thread time
- Render time
- etc


This PR is a very small proof of initial concept and I'll continue to
build this infrastructure out so Zed and other gpui apps can become a
lot more resilient to dropping frames and hangs. Plus it will make
improving performance a lot easier as well in the future.


Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
```

## Parents

- [b764e5e7a3305af35d8f56048989a8347bf94b54](https://git.cafe/gitcafe/zed/commit/b764e5e7a3305af35d8f56048989a8347bf94b54?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/aa6f03bedd562374d55003608357d313e3cafe05?format=markdown)
