I've now written a similar function to revert the buffer, but using replace-buffer-contents as I was suggested. The new attached file contains such function, which I called revert-buffer-with-fine-grain, to honor a previous post. I kept it as similar as I could to the revert-buffer-by-hunks function, and went ahead to time both functions (I figure there will be enough time to add functionality to them). I additionally timed revert-buffer. For the files in Bug#31888, the results were: revert-buffer: 0.122238819 revert-buffer-with-fine-grain: 2.85150876 rbbh-revert-buffer-by-hunks: 2.044583634 all times in seconds, substracting GC time. To gather more data, I compared emacs-25.3 and emacs-26.2 C source files (from the src/ directory), checking them out from the git repository. I did the test as if I was going back from emacs-26.2 to emacs-25.3. I think these files provided a good range of changes in size and number of hunks, obtained from `diff --normal'. I attach the data as ascii file. Let me know if I should send it in another format. The tests are with the latest master, optimized build, run as `emacs -Q'. For the majority of files, revert-buffer and revert-buffer-with-fine-grain spent a similar amount of time when the buffers or changes are not too big, so I believe that's promising for implementing this functionality. On the contrary, reverting by hunks (by calling diff), takes 1 to 4 times more than the other functions, in these cases. When there are many changes, replace-buffer-contents starts taking too much time (as the docs warns). In those situations, reverting by hunks does a much better job than using replace-buffer-contents, but I'm not sure if it does a good enough job. Some problematic files: doprnt.c: revert-buffer-with-fine-grain took 28.6 times more than revert-buffer and rbbh-revert-buffer-by-hunks took 1.4 times more. alloc.c: revert-buffer-with-fine-grain took 18 times more than revert-buffer and rbbh-revert-buffer-by-hunks took 6.5 times more. lisp.h: lisp.h took almost 9 minutes to revert, using revert-buffer-with-fine-grain. It took 0.86 seconds to revert with rbbh-revert-buffer-by-hunks. I'll wait for opinions about the data I've collected. At least it was super fun writing these tests. Best regards, Mauro.