As this has just occurred again... On 2024-08-20 03:00:55 +0200, Vincent Lefevre wrote: > On 2024-08-19 17:17:27 -0700, Paul Eggert wrote: > > On 2024-08-19 16:55, Vincent Lefevre wrote: > > > When opening a .diff file, GNU Emacs runs "diff -ad" on 2 files > > > it has built (I suppose that the reason is to get a word diff), > > > and this can be very slow > > > > That's inherent to the algorithm, no? I don't know of any faster algorithm, > > if you really want minimal output. If you know of one, please let us know. > > > > A simple workaround would be for GNU Emacs to not use the -d (--minimal) > > option.
Well, -d is fast enough most of the time, including via GNU Emacs. So perhaps there should be some form of limit above which this algorithm is dropped. As I've said, this has just occurred again... This happened with "git commit" where I use --verbose by default, and this is the first time I've got such an issue. The change consisted in just replacing a 1-line file by a file with many lines. Something that could be regarded as rather trivial. So, here's a simpler testcase based on that: $ echo . > file1 $ seq 50000 > file2 $ diff -u file1 file2 > file.diff $ emacs file.diff This takes 17 seconds on my machine. With 100000 instead of 50000, this takes 72 seconds, i.e. about 4 times as much. -- 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)
