# perf: Add initial benchmark for markdown element \(\#59524\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 6076ce27384ca14bb9f6fb8b1218acf1d78f2878

Requested commit: 6076ce27384ca14bb9f6fb8b1218acf1d78f2878

Commit: 6076ce27384ca14bb9f6fb8b1218acf1d78f2878

Tree: 741e2ce12c3afec8c4ef5de615134ec54697e8cc

Author: Anthony Eid

Committer: GitHub

## Message

```
perf: Add initial benchmark for markdown element (#59524)

## Summary

This PR adds an initial markdown element renderer benchmark, so we could
later expand this to benchmark search in markdown, and reparsing. This
is important because the agent panel renders a lot of markdown elements,
so I want to use these benchmarks to ensure our markdown element
performance is good, and later expand them to include the agent panel

I added a `bench_util.rs` file that has methods to generate random rust
modules, this will later be used by the editor benchmarks, and is
currently used by the markdown and edit_file_tool benchmarks.

Finally, I made `cx.bench_renderer` also account for ready foreground
tasks and poll them. This more accurately mimics gpui dispatcher. (It's
not perfect, but it's good enough for a benchmark)


## 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 adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A

---------

Co-authored-by: Anant Goel <anant@zed.dev>
```

## Parents

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

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