roslyn: EnC: OutOfMemoryException thrown by LongestCommonSubsequence.ComputeCostMatrix

When editing large methods (1000s of statements).

The algorithm is currently allocating N^2 matrix. It can be optimized to N D or O(N).

Repro:

using System;

class Program
{
    static void Main(string[] args)
    {
        int i = 1;

        if (i == 0)
        {
             Console.WriteLine(0);
             Console.WriteLine(1);
             ...
             Console.WriteLine(10000);
        }
        else 
        {
             Console.WriteLine(0);
             Console.WriteLine(1);
             ...
             Console.WriteLine(10000);
        }
    }
}

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (9 by maintainers)

Commits related to this issue

Most upvoted comments