[Mono-dev] System.Decimal performance

Leszek Ciesielski skolima at gmail.com
Thu May 29 10:06:00 EDT 2008


Hi,

the company I work for builds finance-related software, so we use the
Decimal type a lot. And in any computation-heavy program we find that
the Mono implementation of the decimal type... well... let's just say
it's not on par with MS.Net performance ;-) . Addition, substraction
and multiplication lag a bit (2-4 times slower). However, division is
at least 10 times slower, in some cases even 50x! I don't have any
complex tests at hand right now, but a simple performance-measuring
program is attached to the mail. There's also a java version (although
BigDecimal is not a simple equivalent of System.Decimal as it has no
upper bound on available precision). From my simple test the results
are as follows:

MS.Net 3.5
addition 2375 ms : 2354,156132
substraction 2140,625 ms : 2337,043868
multiplication 1734,375 ms : 189,08461995264
division 8468,75 ms : 29097,233616240416508043573961

Mono 1.9 Windows 2.0 profile
addition 4812 ms : 2354,156132
substraction 4781 ms : 2337,043868
multiplication 3407 ms : 189,08461995264
division 61390 ms : 29097,233616240416508043573961

Mono svn-linux 2.0 profile
addition 4201.837 ms : 2354.156132
substraction 4413.458 ms : 2337.043868
multiplication 4489.036 ms : 189.08461995264
division 61303.573 ms : 29097.233616240416508043573961

Java 1.6.0_06
addition 4640 ms : 2354.156132
substraction 3969 ms : 2337.043868
multiplication 2219 ms : 189.08461995264
division 33376 ms : 29097.233616240416508043573961

Has anyone done any performance tunining with the decimal type?

Regards,

Leszek 'skolima' Ciesielski

-- 
MS-DOS user since 5.0
Windows user since 3.11
Linux user since kernel 2.4
Novell Netware user since 2.2
WARCRAFT user since 1.0
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Program.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080529/1a1cc6bd/attachment.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Program.java
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080529/1a1cc6bd/attachment-0001.pl 


More information about the Mono-devel-list mailing list