[Mono-list] Performance benchmark
Miguel de Icaza
miguel at novell.com
Sun Feb 28 12:36:52 EST 2010
Hello,
First, some stupid Math calculations:
>
> for (int ct = 0; ct < 1000000; ct++)
> {
> decimal d =
> Convert.ToDecimal(Math.Pow(ct, 4));
> d =
> Convert.ToDecimal(Math.Sqrt(Convert.ToDouble(d)) * 4 *
> Math.Atan(Convert.ToDouble(ct)));
> }
>
I looked a little bit into this, and although the above looks
computationally intensive, in Mono the above goes through vast paths of GC
bound operations as our implementation for the Decimal (double) sadly goes
through a very inefficient code path. It allocates strings, formats
strings and does a bunch of extra work.
We probably should implement a Decimal constructor that decodes
double/floats directly.
On a separate note, we have regressed somewhere in trunk compared to 2.6.1.
I include my sample.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20100228/4f2d89c9/attachment.html
More information about the Mono-list
mailing list