[Mono-bugs] [Bug 644699] New: System.Math functions 2x slower than libc

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Oct 7 13:41:13 EDT 2010



           Summary: System.Math functions 2x slower than libc
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.8.x
          Platform: i686
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jonathan.shore at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

Created an attachment (id=393626)
 --> (http://bugzilla.novell.com/attachment.cgi?id=393626)
C++ and C# code for 2 variants of benchmark

Description of Problem:

Benchmarks such as the "language shootout" nbody problem highlight a severe
peformance problem with regard to fundamental numerical routines (such as
Sqrt).   In tests the mono implementation of Sqrt is 2x slower than libc or JVM
implementations.   libc uses MMX instructions in many cases and I believe that
the mono implementation does not

Other math functions in System.Math should also be inspected for their relative
performance to libc.   Suggest the build option or default to map many of the
System.Math functions to libc calls short of a comparably performant
implementation in Mono directly.

Steps to reproduce the problem:
1. Run nbody benchmark on 64 bit linux box  g++ version vs mono C#
2. Run for 500 miilion iterators for fair comparison
2. Observe that C++ implementation 2x as fast
3. change calls to Math.Sqrt and sqrt() in C++ implementation to alternate
inlined implementation
4. Observe that the performance of the 2 programs is 1:1 with an alternate

Actual Results:

191 seconds for mono run
92 seconds c++ run

Expected Results:

~100 seconds for each

How often does this happen? 

Additional Information:

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.

More information about the mono-bugs mailing list