Track dirtyness per item (#26237)
This reduces the number of multibuffer syncs when starting the editor with 80 files open in the Zed repo from 10,000,000 to 100,000 by avoiding O(n**2) dirtyness checks. Release Notes: - Fixed a beachball when restarting in a large repo with a large number open files
This commit is contained in:
parent
263d9ff755
commit
f373383fc1
3 changed files with 43 additions and 7 deletions
|
@ -2112,6 +2112,7 @@ mod tests {
|
|||
})
|
||||
.unwrap();
|
||||
assert!(window_is_edited(window, cx));
|
||||
let weak = editor.downgrade();
|
||||
|
||||
// Closing the item restores the window's edited state.
|
||||
let close = window
|
||||
|
@ -2127,11 +2128,12 @@ mod tests {
|
|||
|
||||
cx.simulate_prompt_answer("Don't Save");
|
||||
close.await.unwrap();
|
||||
assert!(!window_is_edited(window, cx));
|
||||
|
||||
// Advance the clock to ensure that the item has been serialized and dropped from the queue
|
||||
cx.executor().advance_clock(Duration::from_secs(1));
|
||||
|
||||
weak.assert_released();
|
||||
assert!(!window_is_edited(window, cx));
|
||||
// Opening the buffer again doesn't impact the window's edited state.
|
||||
cx.update(|cx| {
|
||||
open_paths(
|
||||
|
@ -2266,6 +2268,8 @@ mod tests {
|
|||
assert_eq!(cx.update(|cx| cx.windows().len()), 1);
|
||||
assert!(cx.update(|cx| cx.active_window().is_some()));
|
||||
|
||||
cx.run_until_parked();
|
||||
|
||||
// When opening the workspace, the window is not in a edited state.
|
||||
let window = cx.update(|cx| cx.active_window().unwrap().downcast::<Workspace>().unwrap());
|
||||
assert!(window_is_edited(window, cx));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue