Subject: bug#12747: 23.4; diff-auto-refine-mode process only last hunk in diff (must ALL).

From: Stefan Monnier <[email-masked]>
Date: Thu, 12 Jul 2018 09:28:57 -0400

> I think you've implemented this now [1: f8b1e40fb6], though not quite in
> the way you describe (I don't see any timers).

Indeed, thanks.

> This reminds that magit users found binding write-region-inhibit-fsync
> around smerge-refine-regions made a noticable performance difference.
> So should we add something like this?

Sounds good, yes (tho I'm surprised it'd make much of a difference,
when your /tmp is on some kind of tmpfs).  If you can add a URL
pointing to the discussion where they found the noticable performance
difference, that'd be even better.

        Stefan

> From e5f3cf973c37ddaca92cc819d95d896ca0d869c7 Mon Sep 17 00:00:00 2001
> From: Noam Postavsky <[email-masked]>
> Date: Wed, 11 Jul 2018 20:13:25 -0400
> Subject: [PATCH] Speed up smerge-refine-regions by avoiding fsync
>
> * lisp/vc/smerge-mode.el (smerge-refine-regions): Bind
> write-region-inhibit-fsync to t.
> ---
>  lisp/vc/smerge-mode.el | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el
> index cb51fbab8e..cb9880c80d 100644
> --- a/lisp/vc/smerge-mode.el
> +++ b/lisp/vc/smerge-mode.el
> @@ -1075,9 +1075,10 @@ smerge-refine-regions
>            (if smerge-refine-weight-hack (make-hash-table :test #'equal))))
>      (unless (markerp beg1) (setq beg1 (copy-marker beg1)))
>      (unless (markerp beg2) (setq beg2 (copy-marker beg2)))
> -    ;; Chop up regions into smaller elements and save into files.
> -    (smerge--refine-chopup-region beg1 end1 file1 preproc)
> -    (smerge--refine-chopup-region beg2 end2 file2 preproc)
> +    (let ((write-region-inhibit-fsync t)) ; Don't fsync temp files.
> +      ;; Chop up regions into smaller elements and save into files.
> +      (smerge--refine-chopup-region beg1 end1 file1 preproc)
> +      (smerge--refine-chopup-region beg2 end2 file2 preproc))
>  
>      ;; Call diff on those files.
>      (unwind-protect