mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-31 19:05:00 +07:00
Follow-up to #57772. While comparing the `edit_file_tool_streaming/medium_insertions` benchmark in Criterion and xctrace, I noticed the DP scoring loop was spending most of its time on inlined `Matrix::get`/`Matrix::set` access in `StreamingDiff::push_new`. This changes the loop to split the previous and current score columns once per DP column and then index those column slices directly. This keeps the scoring algorithm the same, but hoists the column offset calculation out of the inner loop and gives the compiler clearer aliasing information between the immutable previous column and mutable current column. In xctrace, the hottest DP scoring line dropped from 10,407 samples before to 9,409 samples after on `edit_file_tool_streaming/medium_insertions`, and total `StreamingDiff::push_new` leaf samples dropped from 10,800 to 9,822. This is consistently faster in the end-to-end `edit_file_tool` benchmark, and gives a small speed-up for the targeted workload without changing the scoring algorithm. ### Results Benchmarked with `release-fast` against a clean baseline using Criterion’s `before_slice` baseline. #### `streaming_diff_push_new` | Fixture | Before median | After median | Change | | --- | ---: | ---: | ---: | | `tiny_function_rewrite` | `7.6317 ms` | `6.4951 ms` | 10.8% faster | | `small_function_rewrite` | `45.961 ms` | `44.839 ms` | No significant change | | `medium_many_small_changes` | `99.694 ms` | `104.83 ms` | 5.2% slower | | `medium_insertions` | `95.909 ms` | `83.093 ms` | 13.5% faster | #### `edit_file_tool_streaming` | Fixture | Before median | After median | Change | | --- | ---: | ---: | ---: | | `tiny_function_rewrite` | `1.1110 ms` | `1.0617 ms` | 7.1% faster | | `small_function_rewrite` | `2.4554 ms` | `2.2751 ms` | 7.1% faster | | `medium_many_small_changes` | `87.272 ms` | `77.065 ms` | 11.5% faster | | `medium_insertions` | `92.469 ms` | `87.478 ms` | 5.9% faster | The lower-level `streaming_diff_push_new` benchmark is mixed, but the end-to-end `edit_file_tool_streaming` workload improves across all fixtures. 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 or Added/Fixed/Improved ...
114 lines
3.1 KiB
TOML
114 lines
3.1 KiB
TOML
[package]
|
|
name = "agent"
|
|
version = "0.1.0"
|
|
edition.workspace = true
|
|
publish.workspace = true
|
|
license = "GPL-3.0-or-later"
|
|
|
|
[lib]
|
|
path = "src/agent.rs"
|
|
|
|
[features]
|
|
test-support = ["db/test-support"]
|
|
unit-eval = []
|
|
e2e = []
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
acp_thread.workspace = true
|
|
action_log.workspace = true
|
|
async-channel.workspace = true
|
|
agent-client-protocol.workspace = true
|
|
agent_servers.workspace = true
|
|
agent_settings.workspace = true
|
|
agent_skills.workspace = true
|
|
anyhow.workspace = true
|
|
chrono.workspace = true
|
|
client.workspace = true
|
|
cloud_api_types.workspace = true
|
|
cloud_llm_client.workspace = true
|
|
collections.workspace = true
|
|
context_server.workspace = true
|
|
db.workspace = true
|
|
feature_flags.workspace = true
|
|
fs.workspace = true
|
|
futures.workspace = true
|
|
git.workspace = true
|
|
gpui.workspace = true
|
|
handlebars = { workspace = true, features = ["rust-embed"] }
|
|
heck.workspace = true
|
|
html_to_markdown.workspace = true
|
|
http_client.workspace = true
|
|
indoc.workspace = true
|
|
itertools.workspace = true
|
|
language.workspace = true
|
|
language_model.workspace = true
|
|
language_models.workspace = true
|
|
log.workspace = true
|
|
parking_lot.workspace = true
|
|
paths.workspace = true
|
|
project.workspace = true
|
|
prompt_store.workspace = true
|
|
quick-xml.workspace = true
|
|
regex.workspace = true
|
|
rust-embed.workspace = true
|
|
schemars.workspace = true
|
|
serde.workspace = true
|
|
serde_json.workspace = true
|
|
settings.workspace = true
|
|
shell_command_parser.workspace = true
|
|
smallvec.workspace = true
|
|
sqlez.workspace = true
|
|
streaming_diff.workspace = true
|
|
strsim.workspace = true
|
|
task.workspace = true
|
|
telemetry.workspace = true
|
|
text.workspace = true
|
|
thiserror.workspace = true
|
|
ui.workspace = true
|
|
url.workspace = true
|
|
util.workspace = true
|
|
uuid.workspace = true
|
|
watch.workspace = true
|
|
web_search.workspace = true
|
|
zed_env_vars.workspace = true
|
|
zstd.workspace = true
|
|
|
|
[dev-dependencies]
|
|
async-io.workspace = true
|
|
agent_servers = { workspace = true, "features" = ["test-support"] }
|
|
client = { workspace = true, "features" = ["test-support"] }
|
|
clock = { workspace = true, "features" = ["test-support"] }
|
|
context_server = { workspace = true, "features" = ["test-support"] }
|
|
criterion.workspace = true
|
|
ctor.workspace = true
|
|
db = { workspace = true, "features" = ["test-support"] }
|
|
editor = { workspace = true, "features" = ["test-support"] }
|
|
env_logger.workspace = true
|
|
eval_utils.workspace = true
|
|
fs = { workspace = true, "features" = ["test-support"] }
|
|
git = { workspace = true, "features" = ["test-support"] }
|
|
gpui = { workspace = true, "features" = ["test-support"] }
|
|
gpui_tokio.workspace = true
|
|
language = { workspace = true, "features" = ["test-support"] }
|
|
language_model = { workspace = true, "features" = ["test-support"] }
|
|
lsp = { workspace = true, "features" = ["test-support"] }
|
|
pretty_assertions.workspace = true
|
|
project = { workspace = true, "features" = ["test-support"] }
|
|
rand.workspace = true
|
|
reqwest_client.workspace = true
|
|
settings = { workspace = true, "features" = ["test-support"] }
|
|
tempfile.workspace = true
|
|
|
|
theme = { workspace = true, "features" = ["test-support"] }
|
|
|
|
unindent = { workspace = true }
|
|
|
|
zlog.workspace = true
|
|
|
|
[[bench]]
|
|
name = "edit_file_tool"
|
|
harness = false
|
|
required-features = ["test-support"]
|