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

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


           Summary: Generic casts are slow
    Classification: Mono
           Product: Mono: Runtime
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
          Found By: ---
           Blocker: ---


using System;
using System.Diagnostics;
using System.Collections.Generic;

class A
{
}

class Test : A
{
    static T TestMethod<T> (A a) where T : A
    {
        T t = null;
        for (int i = 0; i < 10000000; ++i)
            t = (T) a;

        return t;
    }


    public static void Main ()
    {
        A target = new Test ();

        var sw = new Stopwatch ();
        sw.Start ();
        TestMethod<Test> (target);
        sw.Stop ();
        Console.WriteLine (sw.ElapsedMilliseconds);
        Console.WriteLine (target.ToString ());
    }
}

The result on 32-bits

Mono: 480
NET 4.0: 90

That's about 5x slower.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to