Parker Loflin
0d3c40e1b9
worktree: Sort removed entry ids once ( #66962 )
...
## Summary
`remove_path_from_snapshot` kept `removed_ids` sorted by inserting each
id at its sorted position. Entries are visited in path order but ids are
assigned in scan order, so most inserts shift part of the `Vec`, and
removing a large subtree is quadratic. This pushes the ids and sorts
once and the resulting `Vec` is the same.
The function runs under the scanner state lock whenever a path is
removed or recursively refreshed. For a directory, that is its whole
loaded subtree.
Times for just the loop:
| Entries | Ids | Before | After |
|---|---|---|---|
| 17,645 | from the scanner | 8.8 ms | 0.19 ms |
| 20,018 | synthetic | 9.1 ms | 0.20 ms |
| 100,010 | synthetic | 195 ms | 1.1 ms |
| 500,005 | synthetic | 5.0 s | 7.0 ms |
The scanner ids were dumped in path order from a scan in a test. The
synthetic ids are assigned breadth-first to a random tree.
## Testing
- The `worktree` integration tests pass
- `./script/clippy -p worktree` passes.
## Self-review
- [x] I have reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist ).
- [x] Tests cover the new or changed behavior.
Release Notes:
- Improved worktree scanner performance when large directories are
removed or rescanned
2026-11-14 11:34:40 +00:00
..
2026-11-13 11:45:35 +00:00
2026-11-02 15:26:50 +00:00
2026-11-14 00:21:14 +00:00
2026-11-11 17:29:24 +00:00
2026-11-06 19:51:13 +00:00
2026-10-01 16:33:50 +00:00
2026-11-13 13:39:11 +00:00
2026-11-10 13:34:40 +00:00
2026-10-07 16:40:00 +00:00
2026-11-13 13:39:11 +00:00
2026-10-26 09:53:33 +00:00
2026-10-13 14:09:05 +00:00
2026-10-29 09:12:10 +00:00
2026-10-09 14:57:03 +00:00
2026-10-05 12:44:26 +00:00
2026-10-15 18:48:40 +00:00
2026-10-05 12:44:26 +00:00
2026-11-13 11:45:35 +00:00
2026-11-03 21:30:48 +00:00
2026-11-11 19:41:39 +00:00
2026-11-10 09:43:33 +00:00
2026-10-05 12:44:26 +00:00
2026-10-05 12:44:26 +00:00
2026-11-03 22:49:20 +00:00
2026-11-05 10:31:08 +00:00
2026-11-13 11:45:35 +00:00
2026-11-13 11:45:35 +00:00
2026-10-22 11:49:45 +00:00
2026-11-10 13:34:40 +00:00
2026-10-07 15:35:34 +00:00
2026-10-06 08:13:27 +00:00
2026-11-13 13:39:11 +00:00
2026-10-05 12:44:26 +00:00
2026-10-23 21:59:20 +00:00
2026-11-02 17:27:20 +00:00
2026-11-02 12:45:55 +00:00
2026-10-05 12:44:26 +00:00
2026-11-13 11:45:35 +00:00
2026-10-05 12:44:26 +00:00
2026-11-13 11:45:35 +00:00
2026-11-13 11:45:35 +00:00
2026-10-29 09:12:10 +00:00
2026-10-23 10:32:56 +00:00
2026-10-05 12:44:26 +00:00
2026-11-13 11:45:35 +00:00
2026-11-13 11:45:35 +00:00
2026-11-03 09:14:29 +00:00
2026-11-13 11:45:35 +00:00
2026-10-29 09:12:10 +00:00
2026-11-13 11:45:35 +00:00
2026-11-02 15:26:50 +00:00
2026-10-05 12:44:26 +00:00
2026-11-13 11:45:35 +00:00
2026-11-06 08:04:15 +00:00
2026-10-20 13:45:52 +00:00
2026-11-13 11:45:35 +00:00
2026-10-12 22:39:18 +00:00
2026-11-09 12:08:31 +00:00
2026-10-05 12:44:26 +00:00
2026-11-10 09:43:33 +00:00
2026-10-02 23:36:48 +00:00
2026-11-12 00:08:05 +00:00
2026-10-19 14:22:10 +00:00
2026-11-13 11:45:35 +00:00
2026-10-29 09:12:10 +00:00
2026-11-10 13:34:40 +00:00
2026-11-11 19:35:59 +00:00
2026-10-30 09:59:44 +00:00
2026-11-13 11:45:35 +00:00
2026-11-13 11:45:35 +00:00
2026-10-28 21:52:54 +00:00
2026-10-12 13:47:49 +00:00
2026-11-13 13:39:11 +00:00
2026-11-14 11:34:19 +00:00
2026-11-12 08:19:32 +00:00
2026-11-13 11:45:35 +00:00
2026-11-13 19:46:43 +00:00
2026-11-13 19:46:43 +00:00
2026-10-19 14:16:08 +00:00
2026-11-13 16:33:49 +00:00
2026-11-10 23:00:03 +00:00
2026-10-05 12:44:26 +00:00
2026-10-05 12:44:26 +00:00
2026-11-13 11:33:53 +00:00
2026-11-13 11:45:35 +00:00
2026-11-13 19:46:43 +00:00
2026-11-12 22:39:26 +00:00
2026-10-09 05:44:50 +00:00
2026-10-05 12:44:26 +00:00
2026-11-02 15:51:56 +00:00
2026-10-05 12:44:26 +00:00
2026-10-29 09:12:10 +00:00
2026-10-26 13:46:57 +00:00
2026-11-09 11:01:36 +00:00
2026-10-09 05:44:50 +00:00
2026-10-05 12:44:26 +00:00
2026-10-05 12:44:26 +00:00
2026-10-05 10:37:17 +00:00
2026-11-13 11:45:35 +00:00
2026-11-13 11:45:35 +00:00
2026-11-13 11:45:35 +00:00
2026-10-21 16:49:51 +00:00
2026-11-13 11:45:35 +00:00
2026-11-13 13:39:11 +00:00
2026-11-14 01:07:10 +00:00
2026-11-13 13:39:11 +00:00
2026-10-05 10:37:17 +00:00
2026-11-13 11:45:35 +00:00
2026-11-13 12:27:17 +00:00
2026-10-05 12:44:26 +00:00
2026-11-13 11:45:35 +00:00
2026-09-30 22:12:16 +00:00
2026-10-21 17:41:09 +00:00
2026-10-05 10:37:17 +00:00
2026-10-22 11:49:45 +00:00
2026-11-13 11:45:35 +00:00
2026-11-07 09:46:58 +00:00
2026-11-12 14:52:36 +00:00
2026-10-02 11:22:04 +00:00
2026-11-11 19:08:16 +00:00
2026-10-05 12:44:26 +00:00
2026-11-13 11:45:35 +00:00
2026-10-05 12:44:26 +00:00
2026-10-22 04:43:07 +00:00
2026-10-29 14:33:41 +00:00
2026-10-05 12:44:26 +00:00
2026-10-05 12:44:26 +00:00
2026-10-22 11:49:45 +00:00
2026-11-14 01:07:10 +00:00
2026-11-09 12:08:31 +00:00
2026-11-04 14:02:53 +00:00
2026-10-22 13:57:27 +00:00
2026-10-12 13:47:49 +00:00
2026-11-13 11:45:35 +00:00
2026-10-28 15:21:52 +00:00
2026-11-09 12:26:10 +00:00
2026-11-09 12:26:10 +00:00
2026-11-11 19:41:02 +00:00
2026-10-05 10:37:17 +00:00
2026-11-13 12:27:17 +00:00
2026-10-29 09:12:10 +00:00
2026-11-10 13:34:40 +00:00
2026-10-26 15:36:28 +00:00
2026-10-12 13:47:49 +00:00
2026-11-14 11:34:22 +00:00
2026-11-12 21:00:35 +00:00
2026-10-05 12:44:26 +00:00
2026-11-13 11:45:35 +00:00
2026-11-11 21:17:08 +00:00
2026-11-10 13:38:24 +00:00
2026-10-05 12:44:26 +00:00
2026-10-07 11:03:59 +00:00
2026-10-05 12:44:26 +00:00
2026-11-13 11:45:35 +00:00
2026-10-29 09:12:10 +00:00
2026-10-29 09:12:10 +00:00
2026-10-30 12:27:35 +00:00
2026-11-06 14:35:38 +00:00
2026-11-11 19:41:02 +00:00
2026-10-27 00:53:14 +00:00
2026-10-05 12:44:26 +00:00
2026-11-13 11:45:35 +00:00
2026-11-13 11:45:35 +00:00
2026-11-10 23:30:25 +00:00
2026-10-05 10:37:17 +00:00
2026-10-05 20:30:23 +00:00
2026-10-05 12:44:26 +00:00
2026-10-05 12:44:26 +00:00
2026-10-13 13:15:34 +00:00
2026-11-10 13:34:40 +00:00
2026-11-08 20:08:14 +00:00
2026-11-04 15:54:12 +00:00
2026-11-12 14:53:04 +00:00
2026-11-10 09:43:33 +00:00
2026-11-12 15:11:54 +00:00
2026-11-09 11:01:36 +00:00
2026-11-13 11:45:35 +00:00
2026-10-08 15:37:40 +00:00
2026-10-07 14:58:00 +00:00
2026-10-29 09:12:10 +00:00
2026-11-02 22:26:26 +00:00
2026-10-05 12:44:26 +00:00
2026-11-13 11:45:35 +00:00
2026-10-22 11:49:45 +00:00
2026-11-13 16:33:49 +00:00
2026-10-05 12:44:26 +00:00
2026-11-13 12:27:17 +00:00
2026-10-05 12:44:26 +00:00
2026-11-13 11:45:35 +00:00
2026-11-13 11:45:35 +00:00
2026-11-13 05:28:29 +00:00
2026-11-13 11:45:35 +00:00
2026-11-14 11:34:40 +00:00
2026-10-29 09:12:10 +00:00
2026-10-05 12:44:26 +00:00
2026-10-23 13:16:35 +00:00
2026-11-12 21:00:35 +00:00
2026-10-23 21:59:20 +00:00
2026-11-13 11:45:35 +00:00
2026-10-05 12:44:26 +00:00
2026-10-05 12:44:26 +00:00
2026-11-13 11:45:35 +00:00