[Mono-bugs] [Bug 524595] JIT produces very slow code if you use a temporary variable outside a try/catch block

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jul 23 09:54:17 EDT 2009


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

User anto.cuni at gmail.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=524595#c1


Antonio Cuni <anto.cuni at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anto.cuni at gmail.com




--- Comment #1 from Antonio Cuni <anto.cuni at gmail.com>  2009-07-23 07:54:16 MDT ---
after more investigation, I discovered that the culprit is not the try/catch
nor the overflow checking; a temp variable is enough to make the code ~4x
slower even with a very simple loop:

    public static int Fast()
    {
        int i = 0;
        int step = 3;
        while (i < N) {
            i = i + step;
        }
        return i;
    }

    public static int Slow()
    {
        int i = 0;
        int step = 3;
        int tmp = 0;
        while (i < N) {
            tmp = i + step;
            i = tmp;
        }
        return i;
    }


viper tmp $ mono tempvar2.exe 
Fast:  00:00:00.1746620
Slow:  00:00:00.6593390

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


More information about the mono-bugs mailing list