Bug 307280 - Provide a way to disable capping in the comparison algorithm
Summary: Provide a way to disable capping in the comparison algorithm
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M3   Edit
Assignee: Tomasz Zarna CLA
QA Contact:
URL:
Whiteboard: 0.025
Keywords:
Depends on: 322329
Blocks: 325946
  Show dependency tree
 
Reported: 2010-03-27 06:04 EDT by Pawel Pogorzelski CLA
Modified: 2010-10-06 07:55 EDT (History)
8 users (show)

See Also:


Attachments
Initialzing the editor and computing diffs (23.57 KB, image/png)
2010-08-13 06:09 EDT, Tomasz Zarna CLA
no flags Details
dirty fix (6.53 KB, patch)
2010-08-17 05:21 EDT, Tomasz Zarna CLA
no flags Details | Diff
mylyn/context/zip (53.56 KB, application/octet-stream)
2010-08-17 05:21 EDT, Tomasz Zarna CLA
no flags Details
Fix v01 (13.83 KB, patch)
2010-09-13 11:16 EDT, Tomasz Zarna CLA
no flags Details | Diff
mylyn/context/zip (164.97 KB, application/octet-stream)
2010-09-13 11:16 EDT, Tomasz Zarna CLA
no flags Details
Fix v02 (10.28 KB, patch)
2010-09-20 10:21 EDT, Tomasz Zarna CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Pogorzelski CLA 2010-03-27 06:04:27 EDT
Bug 292831 introduced a label notifying a user that comparison results might be inaccurate due to algorithm optimization. User should be able to disable the capping on demand. The way to go is making the message a link or a button.
Comment 1 Samuel Wu CLA 2010-08-05 18:16:50 EDT
I just figured out all the discussion in Bug 292831 was about showing a message. I'm sorry that the message doesn't help in our case (bug 303533). Our customer didn't want to know why the comparison was not a good one. He wanted a right result to be displayed. 
Any target date for this bug?
Comment 2 Tomasz Zarna CLA 2010-08-09 06:12:56 EDT
Would the solution suggested by Pawel in comment 0 work for you and your customer? In case when a faster comparison algorithm has been used, you are informed about that with the message added in bug 292831 and then you will be able to run the comparison one more time, without any capping, by clicking on a link or a button next to the message. 

If this is not acceptable in your case, I will need to ask to read all of the comments from bug 292831 and look for a solution that suits you best. I'm sure guys have considered all possible approaches in their comments and we don't want to go through that again ;) Personally, I like the solution from comment 0.
Comment 3 Dani Megert CLA 2010-08-09 06:41:40 EDT
Note that the uncapped algorithm can take minutes and block the UI without any way to stop it. I doubt that anyone would like to see this happen. People would probably think that the workbench died, especially since no progress is reported. So, before simply starting the uncapped algorithm, we would have to make sure the algorithm can be canceled. Even better would be to report progress in such cases.
Comment 4 Samuel Wu CLA 2010-08-09 09:59:36 EDT
Either a link or button should work fine. 
Wonder whether I can ask for a preference setting for this feature. The comparison can be a optimized one by default. The user can change it to the full text comparison to avoid clicking the link/button again and again.
For the UI lock part, I can not agree more that a way to cancel the comparison should be provided. And I hope the locked part is only the compare editor itself. The rest of the UI should be still available to the user during the comparing.
Comment 5 Tomasz Zarna CLA 2010-08-11 06:12:56 EDT
(In reply to comment #3)
> So, before simply starting the uncapped algorithm, we would have to
> make sure the algorithm can be canceled. Even better would be to report progress
> in such cases.

I totally agree. I thought we already have a bug for that, but couldn't find it, so I filed a new one -- bug 322329. Once the blocker is fixed, we can proceed with adding a link or button (this bug).

Regarding the preference, Pawel already suggested that in bug 292831, comment 11, so please see Dani's answer why this is not a perfect solution.
Comment 6 Samuel Wu CLA 2010-08-11 20:57:55 EDT
It seems that comment 35 made by Dani is the final proposal. And He suggested preferences page as the item (e). Was I reading correctly?
Comment 7 Tomasz Zarna CLA 2010-08-12 04:31:39 EDT
Well, yeah. He did mention the preference, but it was considered as a last resort. Just after saying that, Dani suggested a solution which we had agreed upon. In the proposition he said we should "enrich the message with either a link or button that allows to run the slower algorithm" (comment 0) as soon as we start to support cancel in the diff algorithm (bug 322329). 

I'm citing Dani and comments from bug 292831 here to emphasize that we've already came up with a solution which in our opinion is the best.

The other thing is that we also agreed that "As a final solution later on it needs to be possible to compare such large files with accurate results" (bug 292831, comment 47), but this is something we most likely we'd *not* want to backport. I guess we will have to revisit that conclusion now.
Comment 8 Dani Megert CLA 2010-08-12 07:56:41 EDT
>I guess we will have to revisit that conclusion now.
Right. The code to cancel the comparison plus the new UI and workflow are probably too big and risky for a maintenance fix. In addition it would add new strings which would not be translated for non-English users.
Comment 9 Samuel Wu CLA 2010-08-12 09:36:21 EDT
Can you please advise what's the current design for this fix and what's the next plan? There are a lot of discussion in bug 292831 and it's not clear what's going to be done. 
By the way. from an end user's point of view, I'd rather to have a slow and accurate result. If I have a big file, I know exactly what is going to happen when I deal with it. And if I'm comparing two files, my goal is to find the difference, not to save the time. As long as a cancel button exists, I can always cancel the comparison if I can not bear it.
Comment 10 Dani Megert CLA 2010-08-12 09:43:44 EDT
>By the way. from an end user's point of view, I'd rather to have a slow and
>accurate result. 
Yep, agree, but so far without the cancel fix it meant that you might have to wait for minutes or hours without progress, the UI blocked and no way out except killing the workbench. I don't think that you'd want that.

>Can you please advise what's the current design for this fix and what's the
>next plan? 
For 3.7 we will allow to cancel and then offer *some* way to choose the slower algorithm.
Comment 11 Samuel Wu CLA 2010-08-12 12:55:42 EDT
Dani's story is scary. I wonder how big the file is.
I'm frequent user of Beyond Compare and I never see a single file compare takes more than a few seconds. I have a file of 7000 lines and 250KB which Eclipse compare can't handle properly. It took Beyond Compare a split second to do the job. If eclipse's accurate algorithm needs hours to finish the job, we may want to open another bug to address the performance issue.
When Dani talked about GUI is locked, I hope it's just the compare editor. There is no reason to lock the other part of the perspective. 
I can't image a fix without a cancel button. Can someone advise what's going to be fixed in 3.6.1?
Comment 12 Dani Megert CLA 2010-08-13 01:50:57 EDT
It will not be the common case that it takes as long as I outlined and it's not just the size of the files but also what the changes are.

>When Dani talked about GUI is locked, I hope it's just the compare editor.
>There is no reason to lock the other part of the perspective. 
I *think* it depends how you open the compare editor, but Tomasz would know better.

>I can't image a fix without a cancel button. Can someone advise what's going to
>be fixed in 3.6.1?
Currently the plan is to fix it in 3.7 as the changes will most likely be to big/risky for 3.6.1. If the 3.7 fix has been in use for a while one could discuss to backport it into 3.6.2.
Comment 13 Tomasz Zarna CLA 2010-08-13 06:09:59 EDT
Created attachment 176536 [details]
Initialzing the editor and computing diffs

(In reply to comment #12)
> >When Dani talked about GUI is locked, I hope it's just the compare editor.
> >There is no reason to lock the other part of the perspective.

The job that initializes and opens the editor can be run in the background, it's non-blocking. The problem is with the diffing algorithm which runs in a *modal* dialog. To make matters worse, the dialog cannot be cancelled and this is what I'm trying to solve in bug 322329. If you have any questions about that, please comment of that bug.

This bug is about providing a way to choose the slower (uncapped) algorithm.
Comment 14 Tomasz Zarna CLA 2010-08-17 05:21:43 EDT
Created attachment 176766 [details]
dirty fix

Here is a dirty fix which I decided to attach only to show how the solution from comment 0 could work. Do not commit!
Comment 15 Tomasz Zarna CLA 2010-08-17 05:21:47 EDT
Created attachment 176767 [details]
mylyn/context/zip
Comment 16 Tomasz Zarna CLA 2010-09-13 11:16:40 EDT
Created attachment 178749 [details]
Fix v01

Fix that adds new option to Compare preference page. The option is actually stored in org.eclipse.compare.code node, so it can be accessed by the code plug-in. However, since the pref page is tightly coupled with OverlayPrefernceStore the option is also stored in the UI plugin which is redundant.
Comment 17 Tomasz Zarna CLA 2010-09-13 11:16:47 EDT
Created attachment 178750 [details]
mylyn/context/zip
Comment 18 Szymon Brandys CLA 2010-09-20 06:45:37 EDT
I would suggest the following changes:
1) Mnemonic 'D' is already used, we could use 'C' instead. 
2) Leave #cappingDisabled and its get/set methods in the core plug-in, but don't store its value in the pref store. The only place to store the capping preference value should be UI (as it is already done).
3) In DocumentMerger#doDiff call ComparePlugin#setCappingDisabled before diffs calculation is performed.
Comment 19 Samuel Wu CLA 2010-09-20 09:42:39 EDT
Thank you for fixing the problem. I wonder how I can pick up a driver to test it.
Comment 20 Tomasz Zarna CLA 2010-09-20 10:21:10 EDT
Created attachment 179249 [details]
Fix v02

1) and 2) applied. As for 3) I decided to set the flag in ComparePlugin (core) on each preference change and on CompareUIPlugin (UI) startup. I did so because DocumentMerger#doDiff is not the only place where I should set the flag and by setting it as in the patch I'm sure it's properly init'ed in the core bundle.
Comment 21 Tomasz Zarna CLA 2010-09-20 10:26:35 EDT
Fix v02 applied to HEAD. Available in builds >=I20100921-0800. Samuel feel free to pick up tomorrow's integration build and verify both fixes. Please, keep in mind that we still haven't fixed bug 324993.
Comment 22 Krzysztof Kazmierczyk CLA 2010-09-22 07:14:46 EDT
fix verified
Comment 23 Tomasz Zarna CLA 2010-09-24 05:07:27 EDT
Sam, have you had a chance to verify the fix as well?
Comment 24 Samuel Wu CLA 2010-09-24 12:40:05 EDT
The build I can find on the eclipse site are I20100922-0800 and I20100921-1024 for 3.7 stream. Both are marked with a red cross for windows 3.2. Which one should I try?
Comment 25 Tomasz Zarna CLA 2010-09-27 05:10:40 EDT
The red cross indicates that some tests have failed. The builds are still good from our perspective. Please, pick any of them.
Comment 26 Samuel Wu CLA 2010-09-27 10:30:22 EDT
I picked up eclipse-SDK-I20100922-0800-win32.zip and it works fine. And I have to say it's pretty fast as well. I really appreciate it.
Comment 27 Krzysztof Kazmierczyk CLA 2010-10-06 07:55:51 EDT
There is also bug to provide documentation to this functionality. This is bug 326678