matthias1955 wrote:Isn't it enough to know the filename, are we interested in size, encoding ,if it is a binays or text file, ?
If yes, so it will be ok to check the encoding once only, the for the second check it must be same.
No, folder compare does not work like that.
Basic design is to have two threads:
- Collector-thread just gets a list of items in the folders. Nothing else. It uses FindFile() to get directory entries (and gets info like sizes and dates "for free"). It does not (and must not!) open files itself. This thread also does not care about compare method-we always need list of items to compare similar way. Line filters are also applied in this thread.
- Compare-thread does actual comparing, depending on selected compare method. This thread opens files if compare engine requires it. Not all compare engines need or care about file contents.
So the Collector thread does not open files and such has no way to determine binary statuses or encodings. If it would open the files too it would slow down the compare. And it would be sometimes totally unnecessary work and time wasted. As not all compare engines need that info.
For folder compare most important factor for the speed is how much we need to access files. Minimizing filesystem access is key point. Adding file opening to collector thread would be very bad idea.
Consider
By Modified date-compare method. It gets all the information it needs from the collector thread. So it doesn't even touch the files in compare thread. Which makes it very fast. Indeed, the "compare" is just comparing two time/size values and the slowest part is collecting that data.