Compare by content: deal better w/ large(r) files

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Compare by content: deal better w/ large(r) files

Post by *gdpr deleted 6 »

TC's current "compare by content" function essentially does two file comparisons (one partial plus one full comparison) for comparing two files which have same size but some differences in their content. The first comparison reads files until a first difference is found, then the second comparison in the diff tool does read and compare the files again.

This is not so relevant with small-ish files, but when file sizes become larger and the differences are closer to the end of the files, then the first comparison (which only looks for the first difference) becomes practically an almost full file comparison. For those cases, the time it takes is not only twice as much as necessary, but the time spend on two comparisons instead of one can be significant for larger files (exacerbated if both files are on the same physical disk or on a network share).


My suggestion would be to improve the "Compare by content" function to only require one file comparison, while hopefully keeping the implementation effort minimal.

The procedure should start with finding the first difference in the files to compare (more or less the same what TC does now when it shows the little dialog with the progress bar). If there is no difference, show the identical files dialog as usual.

If a first difference is found, open the diff tool window. But now, instead of restarting the comparison from the beginning of the file, pass the information about the first file difference (i.e. its file position) to the diff tool. The diff tool will continue the file comparison from the file position of the first difference. (Technically, the comparison routine of the diff tool does not need to be changed at all except letting it start at the given file position instead from the beginning of the file.)

Side note: Currently, even when selecting other files directly in the diff tool and pressing the "Compare" button, the diff tool does seem to do one partial comparison followed by a full comparison, which is also not really necessary...
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48097
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Sounds like a nice idea!
Author of Total Commander
https://www.ghisler.com
Post Reply