Allow project search to be efficiently cancelled#45300
Allow project search to be efficiently cancelled#45300maxbrunsfeld wants to merge 3 commits intomainfrom
Conversation
|
I've benchmarked this branch against main (3 times each) and found the following: I'll update fs_benchmarks for this new scenario as well. |
|
fs_benchmarks don't look great too with smol. With the following patch: diff --git a/crates/fs_benchmarks/src/main.rs b/crates/fs_benchmarks/src/main.rs
index 12df32f076..330ca5760f 100644
--- a/crates/fs_benchmarks/src/main.rs
+++ b/crates/fs_benchmarks/src/main.rs
@@ -25,6 +25,15 @@ fn main() {
} else {
println!("Took {elapsed:?} to query metadata");
};
+
+ let timer = std::time::Instant::now();
+ let result = fs.open_read(path_to_read.as_ref()).await;
+ let elapsed = timer.elapsed();
+ if let Err(e) = result {
+ println!("Failed `open_sync` after {elapsed:?} with error `{e}`");
+ } else {
+ println!("Took {elapsed:?} to open");
+ };
std::process::exit(0);
})
.detach();It takes about 10 microseconds on main and ~100 microseconds on this branch. :/ I realize there's more to it (the interface exposed by I'll run benches on Linux too. Maybe that'll shed some more light. |
|
Closing this in favor of #45406 ; it differs in exposed interface ( |
- **search: Make search cancellation more responsive (again)** - **Fix project benchmarks build** - **Less scoping and lifetimes for workers** Related to #45300 Release Notes: - Project search will consume less resources immediately after cancellation. --------- Co-authored-by: Max Brunsfeld <max@zed.dev>
- **search: Make search cancellation more responsive (again)** - **Fix project benchmarks build** - **Less scoping and lifetimes for workers** Related to #45300 Release Notes: - Project search will consume less resources immediately after cancellation. --------- Co-authored-by: Max Brunsfeld <max@zed.dev>
- **search: Make search cancellation more responsive (again)** - **Fix project benchmarks build** - **Less scoping and lifetimes for workers** Related to zed-industries#45300 Release Notes: - Project search will consume less resources immediately after cancellation. --------- Co-authored-by: Max Brunsfeld <max@zed.dev>
- **search: Make search cancellation more responsive (again)** - **Fix project benchmarks build** - **Less scoping and lifetimes for workers** Related to zed-industries#45300 Release Notes: - Project search will consume less resources immediately after cancellation. --------- Co-authored-by: Max Brunsfeld <max@zed.dev>
Previously, cancelling did not really terminate the search computations, due to detaching the owning Task, and due to synchronous IO that was used to find candidate files.
Release Notes: