Scope line layout cache to each window (#7235)

This improves a performance problem we were observing when having
multiple windows updating at the same time, where each window would
invalidate the other window's layout cache.

Release Notes:

- Improved performance when having multiple Zed windows open.

Co-authored-by: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Antonio Scandurra 2024-02-02 10:11:20 -07:00 committed by GitHub
parent 5360c0ea28
commit a0b52cc69a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 104 additions and 78 deletions

View file

@ -143,7 +143,7 @@ impl Boundary {
#[cfg(test)]
mod tests {
use super::*;
use crate::{font, TestAppContext, TestDispatcher, TextRun, WrapBoundary};
use crate::{font, TestAppContext, TestDispatcher, TextRun, WindowTextSystem, WrapBoundary};
use rand::prelude::*;
#[test]
@ -218,7 +218,7 @@ mod tests {
#[crate::test]
fn test_wrap_shaped_line(cx: &mut TestAppContext) {
cx.update(|cx| {
let text_system = cx.text_system().clone();
let text_system = WindowTextSystem::new(cx.text_system().clone());
let normal = TextRun {
len: 0,