Control: forwarded -1 https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79546
Control: retitle -1 emacs: opening a diff file in diff-mode can be very slow
Control: found -1 1:30.1+1-6
Control: found -1 1:30.1+1-9

On 2024-08-20 16:14:37 +0200, Santiago Vila wrote:
> As pointed out by Paul Eggert in bug-diffutils, diff -d
> is *inherently* slow. This is documented in the diff --help
> output:
> 
> -d, --minimal    try *hard* to find a smaller set of changes
> 
> and also in the texinfo manual:
> 
> '-d'
> '--minimal'
>      Change the algorithm perhaps find a smaller set of changes.  This
>      makes 'diff' slower (sometimes much slower).
> 
> Since I can't control how emacs calls diff, there is nothing I can
> reasonably do on the diffutils packaging side.

So I've reported the bug against GNU Emacs upstream:
  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79546

with a simpler testcase:

$ echo . > file1
$ seq 50000 > file2
$ diff -u file1 file2 > file.diff
$ emacs -Q file.diff

takes 17 seconds on my machine. With 100000 instead of 50000,
this takes 72 seconds, i.e. about 4 times as much.

But I think that the best solution would be a limit detection
in diff, above which the faster (but not giving a minimal diff)
algorithm should be used.

-- 
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)

Reply via email to