From 4f57eefe1e84b5a90e08474092ea6fc8825ad5c9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 24 Aug 2019 20:54:19 +0200 Subject: patch 8.1.1922: in diff mode global operations can be very slow Problem: In diff mode global operations can be very slow. Solution: Do not call diff_redraw() many times, call it once when redrawing. And also don't update folds multiple times. --- src/diff.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/diff.c') diff --git a/src/diff.c b/src/diff.c index 260fdd96d..4c0041d41 100644 --- a/src/diff.c +++ b/src/diff.c @@ -75,7 +75,6 @@ static int diff_buf_idx_tp(buf_T *buf, tabpage_T *tp); static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T line2, long amount, long amount_after); static void diff_check_unchanged(tabpage_T *tp, diff_T *dp); static int diff_check_sanity(tabpage_T *tp, diff_T *dp); -static void diff_redraw(int dofold); static int check_external_diff(diffio_T *diffio); static int diff_file(diffio_T *diffio); static int diff_equal_entry(diff_T *dp, int idx1, int idx2); @@ -520,7 +519,8 @@ diff_mark_adjust_tp( if (tp == curtab) { - diff_redraw(TRUE); + // Don't redraw right away, this updates the diffs, which can be slow. + need_diff_redraw = TRUE; /* Need to recompute the scroll binding, may remove or add filler * lines (e.g., when adding lines above w_topline). But it's slow when @@ -645,13 +645,14 @@ diff_check_sanity(tabpage_T *tp, diff_T *dp) /* * Mark all diff buffers in the current tab page for redraw. */ - static void + void diff_redraw( int dofold) // also recompute the folds { win_T *wp; int n; + need_diff_redraw = FALSE; FOR_ALL_WINDOWS(wp) if (wp->w_p_diff) { -- cgit v1.2.1