Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-team-dev] Comparision limits

Hi,

I've spent much time digging in LSC code trying to figure out the
problem when some files represented in wrong way (as compared to the
results produced by other compare tools, including diff).

Finally, I've found that the problem is caused by max_differences
assigned in LSC:longestCommonSubsequence()

               max_differences = (length1 + length2 + 1) / 2; // ceil((N+M)/2)
               if ((double) length1 * (double) length2 > TOO_LONG) {
                       // limit complexity to D^POW_LIMIT for long sequences
                       max_differences = (int)
Math.pow(max_differences, POW_LIMIT - 1.0);
               }

In my case, lenght1 and length2 are more that 4000. The code above
assigns a value of about 70 (SQRT of max_differences which is above
4000).
At the same time, TOO_LONG seems to allow comparision of 3162x3162
lines since TOO_LONG is 10000000. In this case max_differences is
allowed to be 3162

So, I'm wondering, isn't it a bug in this code?
Shouldn't it be
 max_differences = (int) Math.pow(TOO_LONG, POW_LIMIT - 1.0);

I'm using Eclipse 3.5

Dmitry


Back to the top