Click here to Skip to main content
15,887,477 members
Home / Discussions / C#
   

C#

 
GeneralRe: The performance of LINQ vs. traditional iteration Pin
Simon_Whale30-Apr-13 4:46
Simon_Whale30-Apr-13 4:46 
GeneralRe: The performance of LINQ vs. traditional iteration Pin
Rob Philpott30-Apr-13 4:57
Rob Philpott30-Apr-13 4:57 
GeneralRe: The performance of LINQ vs. traditional iteration Pin
Simon_Whale30-Apr-13 5:32
Simon_Whale30-Apr-13 5:32 
AnswerRe: The performance of LINQ vs. traditional iteration Pin
Freak3030-Apr-13 4:36
Freak3030-Apr-13 4:36 
AnswerRe: The performance of LINQ vs. traditional iteration Pin
Dave Kreskowiak30-Apr-13 5:17
mveDave Kreskowiak30-Apr-13 5:17 
AnswerRe: The performance of LINQ vs. traditional iteration Pin
Pete O'Hanlon30-Apr-13 6:38
mvePete O'Hanlon30-Apr-13 6:38 
GeneralRe: The performance of LINQ vs. traditional iteration Pin
Rob Philpott30-Apr-13 6:49
Rob Philpott30-Apr-13 6:49 
GeneralRe: The performance of LINQ vs. traditional iteration Pin
Simon_Whale30-Apr-13 23:41
Simon_Whale30-Apr-13 23:41 
Its been a fun bit of learning, but I have worked out why it is significantly slower.

The Count() method uses eager evaluation, from reading various sources, this means that the collection is iterated in full when in this case count() is called.

so
C#
var x = from g in numbers where g % 7 == 0 select g;
count = x.Count();


This block uses lazy evaluation to create x, but it is not evaluated until you call Count() which uses eager evaluation.

and
C#
int Count = numbers.Count(p => p % 7 ==0);


this block causes the entire 10 million records to be evaluated.
Every day, thousands of innocent plants are killed by vegetarians.

Help end the violence EAT BACON

AnswerRe: The performance of LINQ vs. traditional iteration Pin
Richard Deeming30-Apr-13 7:24
mveRichard Deeming30-Apr-13 7:24 
GeneralRe: The performance of LINQ vs. traditional iteration Pin
Rob Philpott30-Apr-13 7:54
Rob Philpott30-Apr-13 7:54 
AnswerRe: The performance of LINQ vs. traditional iteration Pin
jschell30-Apr-13 9:54
jschell30-Apr-13 9:54 
QuestionCrystal Report without preview print is not working in published file Pin
swathipd30-Apr-13 0:34
swathipd30-Apr-13 0:34 
AnswerRe: Crystal Report without preview print is not working in published file Pin
Eddy Vluggen30-Apr-13 1:00
professionalEddy Vluggen30-Apr-13 1:00 
GeneralRe: Crystal Report without preview print is not working in published file Pin
swathipd1-May-13 19:00
swathipd1-May-13 19:00 
GeneralRe: Crystal Report without preview print is not working in published file Pin
Eddy Vluggen2-May-13 11:00
professionalEddy Vluggen2-May-13 11:00 
QuestionC# IE toolbar button runs bat or PS script. works one time then doesn't anymore. Pin
Member 990412330-Apr-13 0:19
Member 990412330-Apr-13 0:19 
Questionmodal popup inside another modal popup Pin
Gangula Sneha30-Apr-13 0:05
Gangula Sneha30-Apr-13 0:05 
AnswerRe: modal popup inside another modal popup Pin
GuyThiebaut30-Apr-13 0:38
professionalGuyThiebaut30-Apr-13 0:38 
QuestionRe: modal popup inside another modal popup Pin
Eddy Vluggen30-Apr-13 0:59
professionalEddy Vluggen30-Apr-13 0:59 
AnswerRe: modal popup inside another modal popup Pin
GuyThiebaut30-Apr-13 1:45
professionalGuyThiebaut30-Apr-13 1:45 
GeneralRe: modal popup inside another modal popup Pin
Eddy Vluggen30-Apr-13 2:11
professionalEddy Vluggen30-Apr-13 2:11 
GeneralRe: modal popup inside another modal popup Pin
GuyThiebaut30-Apr-13 2:22
professionalGuyThiebaut30-Apr-13 2:22 
GeneralRe: modal popup inside another modal popup Pin
Eddy Vluggen30-Apr-13 2:52
professionalEddy Vluggen30-Apr-13 2:52 
GeneralRe: modal popup inside another modal popup Pin
GuyThiebaut30-Apr-13 2:53
professionalGuyThiebaut30-Apr-13 2:53 
QuestionVFW blank frames at start of avi Pin
Boris The Bold29-Apr-13 23:24
Boris The Bold29-Apr-13 23:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.