From 36185c47533d6189c9116df7a41a13766ca2b40c Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Tue, 10 Dec 2019 00:35:13 +0100 Subject: Fix colored row reset performance This fixes a bug where a row would always get reset completely if its background does not equal the default terminal background. This leads to big performance bottlenecks when running commands like `echo "\e[41m" && yes`. Instead of resetting the entire row whenever the template cell is not empty, the template cell is now compared to the last cell in the row. The last cell will always be equal to the previous template cell when `row.occ < row.inner.len()` and if `occ` is equal to the row's length, the entire row is always reset anyways. Fixes #2989. --- alacritty_terminal/src/grid/tests.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'alacritty_terminal/src/grid/tests.rs') diff --git a/alacritty_terminal/src/grid/tests.rs b/alacritty_terminal/src/grid/tests.rs index d28e7833..f3480b14 100644 --- a/alacritty_terminal/src/grid/tests.rs +++ b/alacritty_terminal/src/grid/tests.rs @@ -29,6 +29,10 @@ impl GridCell for usize { } fn set_wrap(&mut self, _wrap: bool) {} + + fn fast_eq(&self, other: Self) -> bool { + self == &other + } } // Scroll up moves lines upwards -- cgit