https://bugzilla.novell.com/show_bug.cgi?id=373269

User [EMAIL PROTECTED] added comment
https://bugzilla.novell.com/show_bug.cgi?id=373269#c1


Sebastien Pouliot <[EMAIL PROTECTED]> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
                 CC|                                                |[EMAIL 
PROTECTED]
           Severity|Normal                                          |Enhancement




--- Comment #1 from Sebastien Pouliot <[EMAIL PROTECTED]>  2008-03-29 11:22:13 
MST ---
I liked the idea (there a similar idea for DivRem on the google group) so I
started something. Sadly I found out that, at least by default (which is what
most mono application use), mono does not give better performance when using
Math.Min|Max.

# using Math.Min|Max
[EMAIL PROTECTED]:~/src/bugzilla> mcs minmax.cs
[EMAIL PROTECTED]:~/src/bugzilla> time mono minmax.exe
11727587164160

real    0m23.916s
user    0m23.745s
sys     0m0.092s

# using manually inlined code 
[EMAIL PROTECTED]:~/src/bugzilla> mcs minmax.cs
[EMAIL PROTECTED]:~/src/bugzilla> time mono minmax.exe
11727587164160

real    0m16.622s
user    0m16.445s
sys     0m0.068s


Source code:

using System;

class Program {

        static void Main (string[] args)
        {
                long value = 0;
                for (int i = 0; i < Int16.MaxValue; i++) {
                        for (int j = Int16.MaxValue; j >= 0; j--) {
#if false
                                value += Math.Max (i, j);
                                value -= Math.Min (i, j);
#else
                                value += (i > j) ? i : j;
                                value -= (i < j) ? i : j;
#endif
                        }
                }
                Console.WriteLine (value);
        }
}

Another test (my original one), where the min/max code was inside a method (to
clamp a value) showed similar results.


-- 
Configure bugmail: https://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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to