[Mono-dev] substantial performance regression between 2.10 and 2.6 or impl diff?
Stifu
stifu at free.fr
Sat Aug 27 15:39:24 EDT 2011
Here are my results when running your benchmark.
My PC: a very old a cheap Windows XP Celeron.
I compiled the application with .NET, and ran it with Mono.
I ran the benchmark 3 times to make sure results were reliable.
Mono 2.6.3:
structs: just below 15 seconds
classes: just below 40 seconds
Mono 2.10.3:
structs: just above 19 seconds
classes: just above 40 seconds
So classes are a tiny bit slower, and structs are a fair bit slower.
Jonathan Shore wrote:
>
> I guess the code was trimmed off in the mailer (I sent in the initial
> note). Here it is inlined as text:
>
>
> using System;
>
> namespace TestHeap
> {
>
> public interface IDatum
> {
> long Timestamp { get; }
> }
>
>
> public struct SDelta : IDatum
> {
> public SDelta (long timestamp, long id, double size, double price,
> double maxsize = 0)
> {
> _timestamp = timestamp;
> _id = id;
> _size = size;
> _price = price;
> _maxsize = maxsize;
> }
>
>
> // Properties
>
>
> public long Timestamp
> { get { return _timestamp; } }
>
> public long Id
> { get { return _id; } }
>
> public double Size
> { get { return _size; } }
>
> public double Price
> { get { return _price; } }
>
> public double MaxSize
> { get { return _maxsize; } }
>
>
> // Variables
>
> private long _timestamp;
> private long _id;
> private double _size;
> private double _price;
> private double _maxsize;
> }
>
>
> public class CDelta : IDatum
> {
> public CDelta (long timestamp, long id, double size, double price,
> double maxsize = 0)
> {
> _timestamp = timestamp;
> _id = id;
> _size = size;
> _price = price;
> _maxsize = maxsize;
> }
>
>
> // Properties
>
>
> public long Timestamp
> { get { return _timestamp; } }
>
> public long Id
> { get { return _id; } }
>
> public double Size
> { get { return _size; } }
>
> public double Price
> { get { return _price; } }
>
> public double MaxSize
> { get { return _maxsize; } }
>
>
> // Variables
>
> private long _timestamp;
> private long _id;
> private double _size;
> private double _price;
> private double _maxsize;
> }
>
> class MainClass
> {
> private static SDelta f (int i)
> {
> return new SDelta (i*1000, i, 1e6, 1.400 + i / 1000);
> }
>
> private static CDelta g (int i)
> {
> return new CDelta (i*1000, i, 1e6, 1.400 + i / 1000);
> }
>
>
> public static void Main (string[] args)
> {
> Console.WriteLine ("Running benchmark");
>
> // struct test
> long Tnow1 = DateTime.Now.Ticks;
>
> double sum1 = 0;
> for (int i = 0 ; i < 100000000 ; i++)
> sum1 += f(i).Price;
>
> long Tend1 = DateTime.Now.Ticks;
>
> // class test
> long Tnow2 = DateTime.Now.Ticks;
>
> double sum2 = 0;
> for (int i = 0 ; i < 100000000 ; i++)
> sum2 += g(i).Price;
>
> long Tend2 = DateTime.Now.Ticks;
>
>
> Console.WriteLine ("struct sum: " + sum1 + ", time: " + ((Tend1 -
> Tnow1) / 1e7) + " secs");
> Console.WriteLine ("class sum: " + sum2 + ", time: " + ((Tend2 - Tnow2)
> / 1e7) + " secs");
> }
> }
> }
>
>
> On Aug 27, 2011, at 2:34 PM, Bojan Rajkovic wrote:
>
>>
>> On Aug 27, 2011, at 2:30 PM, Jonathan Shore wrote:
>>
>>>
>>> On Aug 27, 2011, at 2:20 PM, Bojan Rajkovic wrote:
>>>
>>>> On Aug 27, 2011, at 2:15 PM, Jonathan Shore wrote:
>>>>
>>>>>
>>>>> My machine is an old 2006 Mac Pro 1,1 2 x Xeon 5130 (64 bit) running
>>>>> OSX lion. Here are the respective versions of mono:
>>>
>>> Would 32 vs 64 really make that much of a difference? I have used 32
>>> bit C applications without any noticable perf difference.
>>>
>>> I am worried that there may also be a problem with 2.10.x on other
>>> platforms. It would put my mind at ease if this is just a OSX
>>> implementation issue.
>>>
>>> I don't know if I can reasonably install both 2.6.x and 2.10.x on linux
>>> without hand compiling and doing some magic in config. Would be nice
>>> to know that this "benchmark" performs the same or better from 2.6 to
>>> 2.10.
>>>
>>> Jonathan
>>
>> Might make a difference with respect to performance if your struct can
>> fit in the registers on 64-bit, but cannot on 32-bit. :-) If you could
>> post your benchmark code, more people could test.
>>
>> —Bojan
>>
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
--
View this message in context: http://mono.1490590.n4.nabble.com/substantial-performance-regression-between-2-10-and-2-6-or-impl-diff-tp3773349p3773521.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
More information about the Mono-devel-list
mailing list