fs: Replace a bunch of uses of smol::fs with manual impls (#40172)

smol::fs uses a separate threadpool, which is a bit yuck.

This PR also added a benchmark you can use to run a full worktree scan
(initial one, that is) for arbitrary worktree.. and refactored worktree
scanner to use async locks, as otherwise tests were deadlocking. :)
I've benchmarked it against Zed, Linux and Chromium and saw a ~60% drop
in initial worktree scan times across the board.
Release Notes:

- Significantly (3.3x speedup over the old implementation) improved
speed of Zed's worktree scanner, that's responsible for synchronizing
the state of your project with the state of files on hard drive.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
This commit is contained in:
Piotr Osiewicz
2025-10-16 14:49:34 +02:00
committed by GitHub
co-authored by Smit Barmase
parent 9c70ba7dcc
commit c37a2f885a
13 changed files with 432 additions and 188 deletions
+1 -2
View File
@@ -734,7 +734,6 @@ async fn test_write_file(cx: &mut TestAppContext) {
})
.await
.unwrap();
worktree.read_with(cx, |tree, _| {
let tracked = tree
.entry_for_path(rel_path("tracked-dir/file.txt"))
@@ -1537,7 +1536,7 @@ async fn test_random_worktree_operations_during_initial_scan(
assert_eq!(
updated_snapshot.entries(true, 0).collect::<Vec<_>>(),
final_snapshot.entries(true, 0).collect::<Vec<_>>(),
"wrong updates after snapshot {i}: {snapshot:#?} {updates:#?}",
"wrong updates after snapshot {i}: {updates:#?}",
);
}
}