Community
Participate
Working Groups
I20100928-1200. 1. disable to use the capping algo 2. compare two very large files with each other (e.g.: /org.eclipse.jdt.ui/dictionaries/en_GB.dictionary /org.eclipse.jdt.ui/dictionaries/en_US.dictionary 3. in the dialog click cancel ==> I have to wait for about 6 seconds until it cancels and shows not diff. This is about the same time it would have taken without canceling but then I would have seen the diff.
Krzysztof, could you please take a look at it?
(In reply to comment #1) > Krzysztof, could you please take a look at it? OK I will look at that.
I have checked it. The files from [1] contain only one big change which is at the end of the file. Reaching by LCS algorithm to this change takes 0 ms. Then it takes approx 4s on my machine to find which part of the files is exactly different. Then there are no changes to the end of the file. The current implementation of canceling cannot stop in org.eclipse.compare.internal.core.LCS.find_middle_snake(int, int, int, int, int[][], int[]) which takes most of the time in this case. Dani, if you try two big files with many changes or try patch from bug 324993 comment 6 you will observe, that cancel exactly stops comparing in that way, that it exactly lasts less time than waiting until it ends. [1] /org.eclipse.jdt.ui/dictionaries/en_GB.dictionary and /org.eclipse.jdt.ui/dictionaries/en_US.dictionary
> Dani, if you try two big files with many changes or try patch from bug 324993 > comment 6 you will observe, that cancel exactly stops comparing in that way, > that it exactly lasts less time than waiting until it ends. Just try the ones from comment 0. As a user I don't care about the implementation. If I click cancel and have to wait another 6 seconds then this is wrong.
Created attachment 180229 [details] patch Here is the patch. Which solves Dani problem. The patch allows to stop LCS algorithm in org.eclipse.compare.internal.core.LCS.find_middle_snake(int, int, int, int, int[][], int[], SubMonitor). Tomasz, could you look at this patch?
Created attachment 180230 [details] files to test.zip Here are two files on which I have tested my patch. Before applying the patch you cannot stop comparing. After applying the patch, comparing stops immediately when you hit cancel. Just to clarify: the patch also works fine for example from comment 0.
Thanks for the patch Krzysztof, I will try to look at it this Friday.
The patch looks good, extra checking for monitor cancellation did the job. The only thing I was worried about was the fact that calling worked() for a monitor not only checks if the monitor is canceled but also adds a tick. However, playing with the patch I haven't noticed any side effects, except that now I'm able to see the progress monitor for long running computations, which is good. I added a missing param description in javadoc and applied the fix. Thanks Krzysztof. Fixed in HEAD, available in builds >=N20101009-2000.
Verified in N20101010-200: Cancel now happens much faster.