From 798b44934fe36e7fcd738e4395df70fed9246b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 20 Sep 2024 17:14:59 +0200 Subject: [PATCH] render: double-buffer: optimization: skip clean rows When scanning the grid for all-dirty rows (that we can remove from the damage region we're about to memcpy from the old frame), check the row->dirty bit, and skip scanning the cells of that row altogether. We're only looking for rows where all cells are dirty - those rows can be removed from the region we copy from the old frame, since the entire row will be re-rendered anyway. If a row is clean, it *must* be copied from the old frame. --- render.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/render.c b/render.c index 0aa38c1a..d35aa639 100644 --- a/render.c +++ b/render.c @@ -3046,6 +3046,11 @@ reapply_old_damage(struct terminal *term, struct buffer *new, struct buffer *old for (int r = 0; r < term->rows; r++) { const struct row *row = grid_row_in_view(term->grid, r); + if (!row->dirty) { + full_repaint_needed = false; + continue; + } + bool row_all_dirty = true; for (int c = 0; c < term->cols; c++) { if (row->cells[c].attrs.clean) {