From 3d4582d4dc9145270650e12f9ce5a534b888f4a2 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Sat, 24 Jan 2026 00:43:25 +0100 Subject: [PATCH] git: Skip setting language on git index buffer (#47524) Skipping setting the language on the git index text buffer improves snappiness for (very) large git diff multibuffers and also significantly lower peak and steady-state RSS. When tested on the chromium repo with `git reset HEAD~1000` and *all* language extensions installed we notice: * current `main`: peak RSS ~45GB, ss RSS ~39GB * this patch: peak RSS ~30GB, ss RSS ~27GB Release Notes: - Improved memory usage of large git diff multibuffers. --- crates/project/src/git_store.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/project/src/git_store.rs b/crates/project/src/git_store.rs index 1f7056711637421ab142a7ce43ba5839380b4fd6..35c560d6a57b937141494f5537e7fc4a9572d4b6 100644 --- a/crates/project/src/git_store.rs +++ b/crates/project/src/git_store.rs @@ -3210,9 +3210,9 @@ impl BufferGitState { unstaged_diff.as_ref().zip(new_unstaged_diff.clone()) { let task = unstaged_diff.update(cx, |diff, cx| { - if language_changed { - diff.language_changed(language.clone(), language_registry.clone(), cx); - } + // For git index buffer we skip assigning the language as we do not really need to perform any syntax highlighting on + // it. As a result, by skipping it we are potentially shaving off a lot of RSS plus we get a snappier feel for large diff + // view multibuffers. diff.set_snapshot(new_unstaged_diff, &buffer, cx) }); Some(task.await)