[Mono-dev] Linq sample?

pablosantosluac pablosantosluac at terra.es
Tue Sep 25 13:33:30 EDT 2007


well, I'm just "counting the numbers" after retrieving the query (and I 
guess this is NOT the way to do it, but I'm not very used to enumerators, 
specially writing my test with "vi")

Ok, I changed the loop so that now

             foreach( Revision r in query )
             {
 //             Console.WriteLine("{0} - objid:{1}", num, r.ObjId);
                ++num;
                value += r.ObjId;
             }

I print value at the end:

results: 1200000 elements -> linq -> 3ms, iteratively -> 28ms
results: 12000000 elements (12millions) -> linq -> 294ms, iteratively -> 323

Yes, the difference is too small to be meangiful, but still, it is superb.

Is there a way to build the queries dinamically

----- Original Message ----- 
From: "Kamil Skalski" <kamil.skalski at gmail.com>
To: "pablosantosluac" <pablosantosluac at terra.es>
Cc: "Marek Safar" <marek.safar at seznam.cz>; "Robert Jordan" 
<robertj at gmx.net>; <mono-devel-list at lists.ximian.com>
Sent: Tuesday, September 25, 2007 7:13 PM
Subject: Re: [Mono-dev] Linq sample?


>>             foreach( Revision r in query )
>>             {
>> //             Console.WriteLine("{0} - objid:{1}", num, r.ObjId);
>>                ++num;
>>             }
>
> I'm pretty sure (accounting your previous post about superb
> performance) that this loop is actually optimized out by compiler. You
> should *use* the r instance somehow, for example do a sum of all
> r.ObjId values in both of the loops and then check the numbers.
>
> -- 
> Kamil Skalski
> http://nazgul.omega.pl 




More information about the Mono-devel-list mailing list