Files
zed/crates/benchmarks/Cargo.toml
T
Anthony Eid 1f1220db93 gpui: Separate benchmark support from test support (#63039)
`gpui::bench` previously required GPUI's full `test-support` feature.
Any benchmark using the supported GPUI harness therefore compiled
test-only APIs and fakes, even when the benchmark otherwise followed
production dependency paths.

This change introduces `bench-support` as GPUI's canonical benchmark
feature and keeps `bench` as a compatibility alias for existing
consumers. The benchmark feature now exposes only the existing GPUI
internals that `BenchAppContext` needs: the real threaded dispatcher,
profiler integration, and a headless platform surface. Benchmark HTTP
requests use the production `BlockedHttpClient`, so accidental network
access fails instead of silently entering a fake response path.

The current headless implementation reuses the cfg-stripped core of
`TestPlatform`. Test-only prompt state, simulation APIs, and test
executors remain unavailable under `bench-support`. Cargo feature-tree
checks confirm that both `bench-support` and the compatibility alias
remain independent of `test-support`.

This also adds a `gpui-bench` agent skill covering production-shaped
fixtures, frame and foreground responsiveness, macOS headless Metal
rendering, deterministic correctness guards, Criterion measurement,
Instruments symbolication, and the requirement that a benchmark's
complete dependency graph contain no `test-support` feature.

Two follow-ups are intentionally deferred to keep this feature-isolation
change reviewable:

- Extract the shared headless implementation into
`HeadlessPlatformCore`, with separate `BenchPlatform` and `TestPlatform`
wrappers. This will remove benchmark-related cfg branches from the
test-facing type and make their supported surfaces explicit.
- Add a shared scripted HTTP client that compiles independently under
either `http_client/test-support` or `http_client/bench-support`. Tests
and benchmarks could then serve predefined responses through the same
deterministic transport boundary without either support feature enabling
the other; the default benchmark context should remain network-blocked.

This PR only isolates GPUI itself. Migrating downstream benchmark
fixtures that explicitly request other crates' `test-support` features
remains separate work.

Testing performed:

- `cargo tree --offline --package gpui --no-default-features --features
bench-support --edges features --invert gpui`
- `cargo tree --offline --package gpui --no-default-features --features
bench --edges features --invert gpui`
- `cargo check -p gpui --no-default-features --features bench-support`
- `cargo check -p gpui --no-default-features --features bench`
- `git diff --check`

Release Notes:

- N/A
2026-08-26 09:51:50 +00:00

63 lines
1.5 KiB
TOML

[package]
name = "benchmarks"
version = "0.1.0"
edition.workspace = true
publish.workspace = true
license = "GPL-3.0-or-later"
[lib]
path = "src/benchmarks.rs"
doctest = false
[lints]
workspace = true
[dependencies]
rand.workspace = true
[dev-dependencies]
action_log.workspace = true
agent = { workspace = true, features = ["test-support"] }
agent_settings.workspace = true
assets.workspace = true
criterion.workspace = true
editor = { workspace = true, features = ["test-support"] }
futures.workspace = true
gpui = { workspace = true, features = ["bench-support"] }
gpui_platform = { workspace = true, features = ["test-support", "font-kit"] }
itertools.workspace = true
language = { workspace = true, features = ["test-support"] }
language_model = { workspace = true, features = ["test-support"] }
lsp = { workspace = true, features = ["test-support"] }
markdown.workspace = true
multi_buffer.workspace = true
project = { workspace = true, features = ["test-support"] }
prompt_store.workspace = true
serde_json.workspace = true
settings = { workspace = true, features = ["test-support"] }
text.workspace = true
theme = { workspace = true, features = ["test-support"] }
theme_settings.workspace = true
ui.workspace = true
util = { workspace = true, features = ["test-support"] }
zed_actions.workspace = true
[package.metadata.cargo-shear]
ignored = ["gpui_platform"]
[[bench]]
name = "editor_render"
harness = false
[[bench]]
name = "display_map"
harness = false
[[bench]]
name = "edit_file_tool"
harness = false
[[bench]]
name = "markdown_renderer"
harness = false