[Mono-bugs] [Bug 569109] New: Exponentially increasing compile time for nested anonymous functions.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Jan 8 06:35:48 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=569109

http://bugzilla.novell.com/show_bug.cgi?id=569109#c0


           Summary: Exponentially increasing compile time for nested
                    anonymous functions.
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.4.x
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: kannan at cakoose.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.6)
Gecko/20091215 Ubuntu/9.10 (karmic) Firefox/3.5.6

Compile the following code using gmcs (I used version 2.4.2.3).  On my computer
it doesn't finish compiling (I gave it 10 minutes).  It seems the compilation
time increases exponentially with the number of nested "Run(() => ... )"
expressions.

   class Test
   {
      static T Run<T>(System.Func<T> f) { return f(); }

      public static void Main()
      {
         int x =
            Run(() =>
               Run(() =>
                  Run(() =>
                     Run(() =>
                        Run(() =>
                           Run(() =>
                              Run(() =>
                                 Run(() =>
                                    Run(() =>
                                       Run(() =>
                                          Run(() =>
                                             Run(() =>
                                                Run(() =>
                                                   Run(() =>
                                                      Run(() => 1)
                                                   )
                                                )
                                             )
                                          )
                                       )
                                    )
                                 )
                              )
                           )
                        )
                     )
                  )
               )
            );

         System.Console.WriteLine(x);
      }
   }

This issue actually came up in a "regular" programming situation (i.e. I'm
wasn't just trying to break the compiler).  It took forever for my friend
isolate this issue as the reason his code was taking 5 minutes to compile.

Reproducible: Always

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list