bug-diffutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-diffutils] bug#49038: Speeding up diff on Windows


From: Gisle Vanem
Subject: [bug-diffutils] bug#49038: Speeding up diff on Windows
Date: Tue, 15 Jun 2021 13:57:49 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

Hello list.

I feel a 'diff --recursive ..' takes way too much time
to diff 2 trees of a few 1000 files each.

Reading the MSDN docs for '_open()', the under-laying
cache-behaviour and the 'O_SEQUENTIAL' flag, it seems
sensible that the Windows "Cache Manager" [1] works
faster with the 'O_SEQUENTIAL' flag. So with this
little pseudo-patch of 'diff.c':

+#ifndef O_SEQUENTIAL
+#define O_SEQUENTIAL 0
+#endif
       /* Open the files and record their descriptors.  */

       int oflags = O_RDONLY | (binary ? O_BINARY : 0);
+      oflags |= O_SEQUENTIAL;
+
       if (cmp.file[0].desc == UNOPENED)
         if ((cmp.file[0].desc = open (cmp.file[0].name, oflags, 0)) < 0)

I seem to get the job done quicker. I cannot give any numbers on
the speed-increase. But others may have some comments?

[1] https://docs.microsoft.com/en-us/windows/win32/fileio/file-caching

--
--gv





reply via email to

[Prev in Thread] Current Thread [Next in Thread]