mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-09 21:26:14 +03:00
8ec680cecb
***Update**: after rebasing on top of https://github.com/zed-industries/zed/pull/16915/ (that also changed how search worked), the results are still good, but not 10x. Instead of going from 10s to 500ms, it goes from 10s to 3s.* This improves the performance of project-wide search by an order of magnitude. After digging in, @as-cii and I found that opening buffers was the bottleneck for project-wide search (since Zed opens, parses, ... buffers when finding them, which is something VS Code doesn't do, for example). So this PR improves the performance of opening multiple buffers at once. It does this by doing two things: - It batches scan-requests in the worktree. When we search, we search files in chunks of 64. Previously we'd handle all 64 scan requests separately. The new code checks if the scan requests can be batched and if so it, it does that. - It batches `git status` calls when reloading the project entries for the opened buffers. Instead of calling `git status` for each file, it calls `git status` for a batch of files, and then extracts the status for each file. (It has to be said that I think the slow performance on `main` has been a regression introduced over the last few months with the changes made to project/worktree/git. I don't think it was this slow ~5 months ago. But I also don't think it was this fast ~5 months ago.) ## Benchmarks | Search | Before | After (without https://github.com/zed-industries/zed/pull/16915) | After (with https://github.com/zed-industries/zed/pull/16915) |--------|--------|-------|------| | `zed.dev` at `2b2a501192e78e`, searching for `<` (`4484` results) | 3.0s<br>2.9s<br>2.89s | 489ms<br>517ms<br>476ms | n/a | | `zed.dev` at `2b2a501192e78e`, searching for `:` (`25886+` results) | 3.9s<br>3.9s<br>3.8s | 70ms<br>66ms<br>72ms | n/a | | `zed` at `55dda0e6af`, searching for `<` (`10937+` results) | 10s<br>11s<br>12s | 500m<br>499ms<br>543ms | 3.4s<br>3.1s<br> | (All results recorded after doing a warm-up run that would start language servers etc.) Release Notes: - Performance of project-wide search has been improved by up to 10x. --------- Co-authored-by: Antonio <antonio@zed.dev>
60 lines
1.3 KiB
TOML
60 lines
1.3 KiB
TOML
[package]
|
|
name = "worktree"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
publish = false
|
|
license = "GPL-3.0-or-later"
|
|
|
|
[lib]
|
|
path = "src/worktree.rs"
|
|
doctest = false
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[features]
|
|
test-support = [
|
|
"language/test-support",
|
|
"settings/test-support",
|
|
"text/test-support",
|
|
"gpui/test-support",
|
|
"http_client/test-support",
|
|
]
|
|
|
|
[dependencies]
|
|
anyhow.workspace = true
|
|
clock.workspace = true
|
|
collections.workspace = true
|
|
fs.workspace = true
|
|
futures.workspace = true
|
|
fuzzy.workspace = true
|
|
git.workspace = true
|
|
gpui.workspace = true
|
|
ignore.workspace = true
|
|
language.workspace = true
|
|
log.workspace = true
|
|
parking_lot.workspace = true
|
|
paths.workspace = true
|
|
postage.workspace = true
|
|
rpc.workspace = true
|
|
schemars.workspace = true
|
|
serde.workspace = true
|
|
serde_json.workspace = true
|
|
settings.workspace = true
|
|
smallvec.workspace = true
|
|
smol.workspace = true
|
|
sum_tree.workspace = true
|
|
text.workspace = true
|
|
util.workspace = true
|
|
|
|
[dev-dependencies]
|
|
clock = {workspace = true, features = ["test-support"]}
|
|
collections = { workspace = true, features = ["test-support"] }
|
|
env_logger.workspace = true
|
|
git2.workspace = true
|
|
gpui = {workspace = true, features = ["test-support"]}
|
|
http_client.workspace = true
|
|
rand.workspace = true
|
|
settings = {workspace = true, features = ["test-support"]}
|
|
pretty_assertions.workspace = true
|